Cascading falls under a separate proposal. There's an intermediate form which stagnated here: https://gist.github.com/erica/6794d48d917e2084d6ed <https://gist.github.com/erica/6794d48d917e2084d6ed>
As Xiaodi Wu pointed out, you can introduce an implementation of `with` that uses reflection but that would be deferred to a later date when reflection itself gets updated. -- E > On Dec 20, 2016, at 7:44 AM, Martin Waitz <[email protected]> wrote: > > Am 2016-12-19 20:44, schrieb Erica Sadun via swift-evolution: >> https://github.com/apple/swift-evolution/pull/346 > > -1 > I don't like where this is heading. > > If you want to introduce method cascading, then have a look at Dart. > > E.g. the example from the pull request could be something like this: > > let questionLabel = UILabel() > ..textAlignment = .Center > ..font = UIFont(name: "DnealianManuscript", size: 72) > ..text = questionText > > The expression could still work on a mutable struct/class which later becomes > immutable by using the `let` assignment. > > The other example which silently creates a new instance is even worse. > If you want to do something like this, then please do it more explicitly. > E.g.: > > let fewerFoos = foos.clone() > ..remove(at: i) > > Anyway, all of this is simply syntactic sugar and should wait... > > -- > Martin
_______________________________________________ swift-evolution mailing list [email protected] https://lists.swift.org/mailman/listinfo/swift-evolution
