[swift-evolution] Proposal: Re-instate mandatory self for accessing instance properties and functions (David Hart)

Lukas Stabe ahti333 at gmail.com
Tue Dec 8 18:56:15 CST 2015


I don’t agree with the premise that forcing `self` everywhere would improve clarity. I love it that lines like this:
    
    buildSubviewInMode(mode).forEach(addSubview)

don’t look like this anymore:

    self. buildSubviewInMode(self.mode).forEach(self.addSubview)

To me, the version without `self` is much clearer. Now of course people may disagree and that’s why a linter might enforce a coding style that requires self. But I don’t think the language itself should enforce that.

- Lukas


More information about the swift-evolution mailing list