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

Yichen Cao ycao at me.com
Sun Dec 6 17:52:10 CST 2015


But swift is all about verbosity (with method naming and such brought from obj-c), having self is much clearer. 

Yichen

> On Dec 7, 2015, at 06:55, Nick Shelley <nickmshelley at gmail.com> 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
> 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20151207/66448896/attachment.html>


More information about the swift-evolution mailing list