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

Bill Burgar bill at burgar.co.uk
Wed Dec 16 14:18:27 CST 2015


I'd like to +1 the proposal.

I think the reasoning is very sound in terms of the readability of code.
In particular in code reviewing, reading code that I haven't looked at
for a while or that I'm otherwise unfamiliar with; the lack of a self
identifier on properties means that I'm continually checking back in the
code (often requiring scrolling) to be sure that I'm looking at a
property or local var. That continual eye skipping back is a serious
impediment to fluent reading of code that this proposal would go some
way to improving.

The arguments in favour of removing self that claim to make code more
readable (I think) centre on the idea that there are fewer characters on
the line - which is a fair point - it makes direct reading easier but I
think overall increases ambiguity in the mind of the reader
(particularly where the reader is not the original writer of the code).
Typically, if you are a single developer that would make this counter
claim stronger. If you are working as part of a team, doing code reviews
and picking up unfamiliar code, unambiguous reading is more valuable.
I'm coming at this from the point of view of working as part of a team
and that gives more strength to the proposal.

Regards

Bill.


On Wed, Dec 16, 2015, at 08:02 PM, Vinicius Vendramini via swift-evolution wrote:
> Same here: not much to add, but also a -1 on this proposal.
>
> I would, however, like to bring up the obvious comparison between
> swift and objective-c. Swift is much more readable for a series of
> reasons, and the fact that ‘self’ isn’t mandatory is doubtlessly one
> of them.
>
>> On Dec 16, 2015, at 2:52 PM, Marco Masser via swift-evolution <swift-
>> evolution at swift.org> wrote:
>>
>> I don't have anything to add to Michael's answer but want to add
>> my voice to this side of the argument. I'd answer ever question as
>> he did.
>>
>> On Wednesday, December 16, 2015, Michael Wells via swift-evolution
>> <swift-evolution at swift.org> wrote:
>>> * What is your evaluation of the proposal?
>>>
>>> -1
>>>
>>> I’m not in favor of the changes. After adopting the current Swift
>>> style of omitting self when possible, I find my code is much more
>>> readable. I certainly understand and respect the reasoning behind
>>> the proposal, but I am not convinced that the changes are worth
>>> the cost.
>>>
>>> * Is the problem being addressed significant enough to warrant a
>>>   change to Swift?
>>>
>>> I don’t think so. This seems like something best addressed with a
>>> code style or formatting tool. Nothing prohibits you from requiring
>>> the use of self in your own code.
>>>
>>> * Does this proposal fit well with the feel and direction of Swift?
>>>
>>> I do like that it would lead to consistent code: you always use self
>>> to access instance members. On the other had, the visual weight of
>>> it seems to outbalance any gain.
>>>
>>> * 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 always preferred the style that Swift has adopted and will
>>> continue to use that if at all possible.
>>> * How much effort did you put into your review? A glance, a quick
>>>   reading, or an in-depth study?
>>>
>>> I’ve been keeping up with the thread, but I didn’t do any in-depth
>>> study or anything.
>>>
>>>
>>>> On Dec 16, 2015, at 10:58 AM, Douglas Gregor via swift-evolution
>>>> <swift-evolution at swift.org> wrote:
>>>>
>>>> All of the prior swift-evolution commentary on this proposal (which
>>>> is nearing the 100-message mark) will also be considered, of
>>>> course!
>>>>
>>>> - Doug
>>>>
>>>>> On Dec 16, 2015, at 10:55 AM, Douglas Gregor via swift-evolution
>>>>> <swift-evolution at swift.org> wrote:
>>>>>
>>>>> Hello Swift community,
>>>>>
>>>>> The review of “Require self for accessing instance members” begins
>>>>> now and runs through Sunday, December 20th. The proposal is
>>>>> available here:
>>>>>
>>>>> https://github.com/apple/swift-evolution/blob/master/proposals/0009-require-self-for-accessing-instance-members.md
>>>>>
>>>>> Reviews are an important part of the Swift evolution process. All
>>>>> reviews should be sent to the swift-evolution mailing list at
>>>>>
>>>>> https://lists.swift.org/mailman/listinfo/swift-evolution
>>>>>
>>>>> or, if you would like to keep your feedback private, directly to
>>>>> the review manager.
>>>>>
>>>>> What goes into a review?
>>>>>
>>>>> The goal of the review process is to improve the proposal under
>>>>> review through constructive criticism and, eventually, determine
>>>>> the direction of Swift. When writing your review, here are some
>>>>> questions you might want to answer in your review:
>>>>>
>>>>> * What is your evaluation of the proposal? * Is the problem being
>>>>> addressed significant enough to warrant a change to Swift? * Does
>>>>> this proposal fit well with the feel and direction of Swift? * If
>>>>> you have you used other languages or libraries with a similar
>>>>> feature, how do you feel that this proposal compares to those? *
>>>>> How much effort did you put into your review? A glance, a quick
>>>>> reading, or an in-depth study?
>>>>>
>>>>> More information about the Swift evolution process is available at
>>>>>
>>>>> https://github.com/apple/swift-evolution/blob/master/process.md
>>>>>
>>>>> Cheers, Doug Gregor Review Manager
>>>>>
>>>>> _______________________________________________
>>>>> swift-evolution mailing list swift-evolution at swift.org
>>>>> https://lists.swift.org/mailman/listinfo/swift-evolution
>>>>
>>>>  _______________________________________________
>>>> swift-evolution mailing list swift-evolution at swift.org
>>>> https://lists.swift.org/mailman/listinfo/swift-evolution
>>>
>>>
>>  _______________________________________________
>> swift-evolution mailing list swift-evolution at swift.org
>> https://lists.swift.org/mailman/listinfo/swift-evolution
>
>
> _________________________________________________
> swift-evolution mailing list swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20151216/e5dcedc1/attachment.html>


More information about the swift-evolution mailing list