[swift-evolution] [Review] Require self for accessing instance members
glessard at tffenterprises.com
Wed Dec 16 16:33:09 CST 2015
I vote against this proposal.
The stated “advantages" of this proposal are mostly matters of taste and opinion and, as such, are not real advantages at all. Furthermore, the proposal is silent as to the advantage of requiring `self` in `struct` and `enum` definitions.
The only stated advantage that seems relevant is that it lets the compiler “warn users (and [avoid] bugs) where the authors mean to use a local variable but instead are unknowingly using an instance property (and the other way round)."
Given that being the sole genuine “advantage” of this proposal, a clear alternative is to improve and strengthen warnings for some cases of variable shadowing. I might not be opposed to that.
* Is the problem being addressed significant enough to warrant a change to Swift?
* Does this proposal fit well with the feel and direction of Swift?
No. It trades an increased verbosity in all applicable cases for a small clarity advantage in a few cases.
It is not Swift-like at all.
* How much effort did you put into your review? A glance, a quick reading, or an in-depth study?
I read too much of the thread, and have written much Swift code, including a *lot* of closures.
Early on in my use of Swift I regularly wrote `self` in places where it was not required.
Upon reviewing my code, I removed the majority of those for clarity.
More information about the swift-evolution