> On Apr 14, 2016, at 12:30 PM, Andrey Tarantsov <[email protected]> wrote:
> 
>>> I also like the idea of a dedicated method-cascading operator, like what 
>>> Dart has.  It eliminates the need for a programmer to explicitly remember 
>>> to 'return self' at the end of a chainable method.  Not sure how well it'd 
>>> integrate with SE-0047 (@discardableResult) though.
>> 
>> Method cascades draft: https://gist.github.com/erica/6794d48d917e2084d6ed 
>> <https://gist.github.com/erica/6794d48d917e2084d6ed>
>> 
>> deferred to after 3.0
> 
> I really think this settles the discussion, because methods cascades are 
> *the* way to implement this kind of thing. (And for the record, I would 
> prefer a SmallTalk/Dart-like syntax to a "with" statement.)

It's been quite a while since the original discussion and I'm going to go all 
Brent R-G on the answer, which is I've come to prefer the Dart solution for 
cascading, think `with` is better suited for mutating copies of struct 
constants (Immutable setters 
<http://ericasadun.com/2016/03/24/immutable-setters/>, may not be 
language-inclusion suitable), and think binding self in closures is yet a third 
issue.

Brent, concur?

-- E

_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to