[swift-evolution] Method cascading (was Re: Request for Discussion: Setup closures)

Tino Heth 2th at gmx.de
Mon Dec 7 01:08:03 CST 2015


Nice to see that most points from my wishlist 
are already discussed here ;-)
I didn't even know this feature got a name, but it
would be great for working with graphic contexts
and some orher tasks.

But I would prefer another approach over a new keyword:
context.{
moveTo(x: 23, y: 42)
lineTo(x: 0, y: 0)
}
is quite intuitive to me, and I can't see any downsides so far
(first thought was just braces without the dot, but that
could clash when you want to use the syntax with the
return value of a function, which could have a trailing closure).

Something similiar could be archieved by dropping
void as default return value in favour of self...


Von meinem iPhone gesendet


More information about the swift-evolution mailing list