Well, method cascading might also be
an alternative to consider?
In Smalltalk this is possible like so:
print: “Hmmm, that was good!”
In Smalltalk, the semicolon closes the method cascading
In Dart, method cascading goes like this:
..print( “Hmmm, that was good!”)
cascading is indicated by a .. doubleDot, preceding the method names
Why not implement this in Swift?
in that case the semicolon would not be needed.
What to do with methods (functions) that return something?
(in Smalltalk, like in Swift?, if i remember correctly, ‘self’ is implicitly
returned in absence of a return value and can be ignored.
On 13.04.2016 18:09, Radosław Pietruszewski wrote:
I’m -1, at least in the foreseeable future. I do agree that this is a
useful construct, but if I can do it in library code, paying only a small
price for this, I’d prefer Swift to grow better in places that a library
Well, there a lot of things that *your personal* library can fix for you.
Should we stop improve the language and start to write just personal libs
This proposals about the feature that makes Swift better, more enjoyable to
Btw, this "with" method you suggest is not replacement for language
construction - it allows compilation when struct instance constant (let s =
SomeStruct()) is changed inside block. Do you like this? Do you want to
produce such an non-safe code to your projects?
No — for now, it’s best to use a free function for now. And, like I
No, not best, even not OK. Described above.
mentioned, universal conformances could allow this to be easily added to
all types — and so I’d focus on pushing *that* proposal.
As I understand, such a method will have the same problem with un-safe
behavior in case of constant.