[swift-evolution] [Review] Require self for accessing instance members
FĂ©lix Cloutier
felixcca at yahoo.ca
Thu Dec 17 01:16:08 CST 2015
I missed the original thread, but I couldn't resist participating in the bike shed exercise (no disrespect meant; it's just that given that we're all expert typers, we all have an opinion on how much we should type). Sorry!
# What is your evaluation of the proposal?
I vote to reject.
# Is the problem being addressed significant enough to warrant a change to Swift?
I'm just a youngin' and I haven't faced as many bugs as some of you veterans have, but of all the bugs that I have bitter memories of, none has ever been caused by the language not enforcing the use of `self`. So far, reading people's opinions, no one has convinced me that omitting `self` in the general case is harmful.
A lot of people have already said that this is a problem better left to tools or processes. I absolutely agree with them. Using a different highlight for members and locals is a possible solution (that is, I believe, already implemented); having in-house style rules is another (always use `self`, prefix members with `m_`, etc).
# Does this proposal fit well with the feel and direction of Swift?
I don't think so. As many people have said already, Swift holds terseness dear, and one reason that Swift feels more terse than Objective-C is that `self` may be omitted.
Many people, me included, do not think that the issue is significant. People who do think that it is have tools at their disposal to help them. If this proposal is accepted, however, people who like saving 5 characters per member use have no possible mechanism to recover the lost terseness.
# If you have used other languages or libraries with a similar feature, how do you feel that this proposal compares to those?
The language I use the most is C++ and it allows me to omit `this->`. I can't remember any hard bug caused by it. However, this requirement exists in Python, and I routinely forget to write `self`. The problems are usually quickly discovered and fixed, and would be even easier to spot in Swift given its nature, but it seems to me that I encounter more issues when `self` is required than when it isn't.
# How much effort did you put into your review? A glance, a quick reading, or an in-depth study?
I read the proposal and a good chunk of this week's discussion.
More information about the swift-evolution
mailing list