[swift-evolution] [Draft] Introducing StaticSelf, an Invariant Self

Vladimir.S svabox at gmail.com
Fri May 13 09:52:09 CDT 2016


After all these discussions, and after I found out *for myself* what does 
the proposed `->StaticSelf` in protocol mean, I'm giving my strong +1 to 
this proposal. This will be a good and useful in some cases language 
feature, that will add flexibility to Swift.

Also it will help to make the code clean and reduce copy-paste errors or 
requirements to re-type concrete type name inside its declaration.
It's so naturally to say 'this concrete type name' i.e. `StaticSelf` 
*inside* the type declaration instead of having its name everywhere. 
Especially, if name of the declaring type has common elements with another 
class like MyVeryGoodClass.f() and MyVeryBadClass.f() so I need to 
carefully read name of which class used.

But the question regarding the name of StaticSelf is still here...
I feel like something that will be resolved at compile-time should have `#` 
before its name.. Probably the best name for me is #BaseType (or #TypeBase, 
or #This #BaseThis #ThisBase)... as having StaticSelf, we IMO should have 
DynamicSelf instead of current `Self`.. Even probably the initially 
proposed #Self is better for me.


More information about the swift-evolution mailing list