[swift-evolution] Spread Operator as Shorthand for Map
matthew at anandabits.com
Wed Dec 16 11:20:02 CST 2015
> This last alternative looks a lot like a special (single expression) case of the Method Cascading proposal <https://bugs.swift.org/browse/SR-160 <https://bugs.swift.org/browse/SR-160>>. If you want to go forward with this shorthand, I’d suggest adding it to method cascading as a rule: Invoking a closure with a single anonymous argument also implicitly begins a cascade with $0 as the default receiver.
Thanks for bringing this up! It is not a special case of that specific proposal but it is a special case of a variation of the proposal that was discussed. Seeing it applied in this context is really interesting.
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:
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-evolution