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

Ray Fix rayfix at gmail.com
Wed Dec 16 15:41:43 CST 2015

	* What is your evaluation of the proposal?

My vote is to reject this proposal.  

	* Is the problem being addressed significant enough to warrant a change to Swift?

I have been writing code that prefers the more succinct style since Swift was announced and have not run into readability issues.  This proposal adds too much visual noise with very little benefit.  

The UIViewController.title example is interesting but I think more of an indictment of  inheritance.  I would have been more open to a proposal that addressed this problem specifically rather than blanket requiring self everywhere.  For example, in cases where you accessing non-private members from a base class, you might require self. 

Giving up the compiler’s hint that you are making a circular retain in a closure is too important to give up.  

	* Does this proposal fit well with the feel and direction of Swift?

This proposal adds too much boilerplate.  I note that the Ray Wenderlich swift style guide whose priorities are for "shorter and more readable code” for conciseness prefers not writing self when not required.  If including self everywhere truly helped readers understand tutorials better, you would expect to see an exception here.

	* If you have you used other languages or libraries with a similar feature, how do you feel that this proposal compares to those?

Many successful languages(C++/Java) do not require you to reference “self" or “this" explicitly.  In using them I have never once thought that they would be improved if doing so was a requirement.

Javascript does require referencing “this" but CoffeeScript makes a shortcut for it to reduce visual noise.  this.thing in Javascript is written @thing in CoffeeScript.

	* How much effort did you put into your review? A glance, a quick reading, or an in-depth study?

I read the proposal carefully and considered all of the points of the author and thought about my own experiences reading Swift code and teaching Swift over the last couple years.  Because of time constraints, I wasn’t able to conduct an in-depth study on the subject.

Ray Fix

More information about the swift-evolution mailing list