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

William Shipley wjs at mac.com
Fri Dec 18 18:19:52 CST 2015


* What is your evaluation of the proposal?

Against.

As self.an self.example, self.you can self.see how much self.harder it is to self.understand this self.sentence. We self.are self.not self.designed to self.scan words with self.self. in self.front of self.them.

The problem with this proposal is simply that using “self.blah” all over the place makes the code less readable. Yes, it can eliminate a certain class of programmer errors. But, for example, I could argue that we could eliminate a certain class of programmer errors if every time we typed in a variable we had to manually enter its type, so like,

foo = foo + 1

must be

foo.Int = foo.Int + 1.Int

Obviously this is a pathological example because the compiler would catch the error in this case anyhow, but my point is that extra words have a cost in terms of programmer comprehension, and sometimes the cost isn’t worth an incremental gain in safety.

Right now Swift is extremely readable and clean. Let’s keep it that way!


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

The problem is big enough but the solution isn’t good enough.


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

It would if I agreed with the solution.


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

I’ve used Objective-C for 26 years, although obviously the “self.” style properties are (relatively) recent.


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

I’ve coded a ton in Swift and considered the arguments for. I also briefly considered this proposal myself a while ago, but decided that it was just too wordy to be worth the extra safety.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20151218/69075144/attachment.html>


More information about the swift-evolution mailing list