[swift-evolution] Proposal: Re-instate mandatory self for accessing instance properties and functions (David Hart)
nickmshelley at gmail.com
Sun Dec 6 16:55:14 CST 2015
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.
> 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
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-evolution