[swift-evolution] [Pitch] Brace omission for single-statement n-ary closures

Patrick Smith pgwsmith at gmail.com
Wed May 25 11:18:02 CDT 2016


I know there was more to what you were suggesting, but can I suggest removing the parentheses:

  let neg = [1, -2, 3].map{ -abs($0) }

  let ascii = words.flatMap{ $0.unicodeScalars.filter{ $0.isASCII } }


Patrick

> On 25 May 2016, at 5:46 AM, Marc Prud'hommeaux via swift-evolution <swift-evolution at swift.org> wrote:
> 
> Everyone loves this syntax:
> 
>   let pos = [1, -2, 3].map(abs)
> 
> This syntax not so much:
> 
>   let neg = [1, -2, 3].map({ -abs($0) })

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160526/b6ea34b0/attachment.html>


More information about the swift-evolution mailing list