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

Tino Heth 2th at gmx.de
Wed Dec 16 15:30:13 CST 2015

> I’m all for this, but couldn’t it be done without the “with”? It doesn’t seem to make the code read any easier.
cool to see that others like the same ideas, uncool that the list traffic is so overwhelming that its easy to overlook those (I’m not even sure who posted that syntax first ;-)

„Visually“, I like the "myObject {" better, but it has a problem that does not exist for "myObject.{":
Imagine you have
func foo(input: Int) -> MyClass
func foo(input: Int, closure: () -> ())

what would "foo(1) {" do?

The point also has the benefit that it already has the meaning "I want to call a message on an object", and the braces would just group a bunch of statements with the exactly same meaning.

Odd that right now there is another thread that wants something in Swift that is nearly the exact opposite of method cascading:
Mandatory self… (I hope Mr. Lattner doesn't try to hard to please everyone on the list - that challenge would surely lead to schizophrenic disorder ;-)

More information about the swift-evolution mailing list