[swift-evolution] [swift-evolution-announce] [Review] Require self for accessing instance members
Kenny Leung
kenny_leung at pobox.com
Fri Dec 18 23:52:54 CST 2015
> * What is your evaluation of the proposal?
+1 for it.
> * Is the problem being addressed significant enough to warrant a change to Swift?
Yes. I feel it makes things more correct.
> * Does this proposal fit well with the feel and direction of Swift?
Yes. One of Swift’s goals is to be clear in reading, and this makes it it readily explicit when an instance property or function is being referred to when reading over code.
> * If you have you used other languages or libraries with a similar feature, how do you feel that this proposal compares to those?
I prefer a shorter syntax, like Ruby’s @blah. It will serve the same purpose, and save some space and typing. In fact, I would prefer to have all scopes of variables decorated so you could tell them all at a glance:
- local variables have no decoration
- instance properties with @
- arguments with $
- statics, globals, etc…
- types that I have to worry about mutating because someone else might have a reference to it vs. ones that I don’t have to worry about. (I used to think this was structs vs classes, but after being on this list I’m not so sure…)
> * How much effort did you put into your review? A glance, a quick reading, or an in-depth study?
I have read about half of the posts on this.
--------------------
Considering this makes me think - if self were not required:
you have a standalone function foo()
you also have an instance method foo()
If you have another instance method
func bar() {
//Could you ever call the standalone function foo?
foo()
}
-Kenny
More information about the swift-evolution
mailing list