> For single-statement closures, ordered parameters could be referenced in an
> autoclosure-like way using a placeholder for the parameter:
>
> let neg = [1, -2, 3].map(-abs(_))
I'm a big fan of this, or something like this, but the core team has rejected
proposals like this before. They apparently believe that it would be difficult
to tell how much of the expression you intended to make a closure of:
let neg = [1, -2, 3].map(-{ abs($0) })
let neg = [1, -2, 3].map({ -abs($0) })
let neg = { [1, -2, 3].map(-abs($0)) }
And believe that this syntax is limited in important ways, like being unable to
reorder parameters. They think that closures with $N are more explicit and
flexible while only requiring a little bit more code.
--
Brent Royal-Gordon
Architechies
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution