[swift-evolution] Spread Operator as Shorthand for Map

Jacob Bandes-Storch jtbandes at gmail.com
Wed Dec 16 11:35:00 CST 2015


Worth noting this can be achieved in Ruby using a shorthand syntax that
turns a symbol into a method:

cars.map(&:make)
On Wed, Dec 16, 2015 at 9:32 AM Al Skipp via swift-evolution <
swift-evolution at swift.org> wrote:

> On 16 Dec 2015, at 17:20, Matthew Johnson via swift-evolution <
> swift-evolution at swift.org> wrote:
>
> Joe Groff noted syntactic ambiguity caused by omitting $0.  Unless that
> potential ambiguity could be resolved in some way this wouldn’t actually
> work.  It does work if you include $0:
>
> cars.map{$0.make}
>
>
> Hey, we’re back where we started! ; )
>
>
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20151216/c0197982/attachment.html>


More information about the swift-evolution mailing list