[swift-evolution] [Review] Require self for accessing instance members

Tino Heth 2th at gmx.de
Sat Dec 19 04:01:07 CST 2015


> 	• What is your evaluation of the proposal?
-1
I like to use the self-prefix in many places, but there is no need to impose personal preferences on those with a different opinion.

> 	• Is the problem being addressed significant enough to warrant a change to Swift?
I doubt that the proposal addresses any existing problem at all; it merely lessens issues due to unfortunate choice of names.

> 	• Does this proposal fit well with the feel and direction of Swift?
When I look at the efforts that were taken to save type strokes when declaring a closure, and how the option of leaving out self is highlighted in the docs: I don't think so.
As others have shown, clarity can be decreased by using the self prefix.

> 	• How much effort did you put into your review? A glance, a quick reading, or an in-depth study?
I've read the whole discussion - although I think that "discussion" is a flattering expression, as I have to look really hard to find any examination of the valid counter arguments.
Pondering over when to use self and when to skip it, I come to the conclusion that I have rules for this, but I would neither dictate those on others nor on the compiler.

> What other solutions can we think up?
1) Use the right tools - syntax coloring can ensure that you don't confuse members with other elements (please no "and what's with those that are color blind?"-arguments: There are other aspects of font that can be changed as well). It would also possible to automatically insert "self." if it is that important.
2) Don't choose names that cause confusion in the first place… doing stupid things leads to stupid problems - but I have to admit that is possible to trip accidentally when choosing a name: For parent methods, this is solved with "override", for other identifiers, there could be warnings.

Best regards,
Tino


More information about the swift-evolution mailing list