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

J. Cheyo Jimenez cheyo at masters3d.com
Sun Dec 6 20:32:15 CST 2015


-1 from me on this one.  I agree with Nick.  IMO forcing self would
actually make the code less readable with a sea of Selfs all over the
place. `Self` blindness. This is not something that should be forced but
something that a linter should `enforce` per project or organization
depending on their style guide.  If anything, I'd like a linter to tell me
when I am declaring self and self is not being captured.


On Sun, Dec 6, 2015 at 4:55 PM, Nick Shelley via swift-evolution <
swift-evolution at swift.org> wrote:

> I like that self is only required in closures because it serves as a good
> reminder that there are memory and safety implications with using self in a
> closure, such as creating retain cycles or having the closure run after
> self has been deallocated.
>
> I can't seem to find an official Apple Swift style guide, but github's (
> https://github.com/github/swift-style-guide) suggests only using self in
> closures with the rationale: "This makes the capturing semantics of self
> stand out more in closures, and avoids verbosity elsewhere."
>
> On Sat, Dec 5, 2015 at 3:16 AM, Yichen Cao <ycao at me.com> wrote:
>
>> Teaching wise, its much less confusing for self to be required so
>> students don't mix up instance properties and local vars. Especially when
>> self is required in closures, it confuses students. If self is mandatory
>> for all instance properties, it would be so much clearer and much easier to
>> read.
>>
>> Yichen
>>
>> On Dec 5, 2015, at 18:11, swift-evolution-request at swift.org wrote:
>>
>> Re: Proposal: Re-instate mandatory self for accessing
>>      instance properties and functions (David Hart)
>>
>>
>>
>> _______________________________________________
>> 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/20151206/0142dd1f/attachment.html>


More information about the swift-evolution mailing list