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

Bart Whiteley bwhiteley at gmail.com
Mon Dec 14 17:52:30 CST 2015

I joined the list late. Apologies for breaking the threading.

On Mon, Dec 14, 2015, 12:30 AM Nick Shelley <nickmshelley at gmail.com> wrote:
> From what I understand, the main reason that self is required in closures
> and not elsewhere is to serve as a compiler-enforced reminder about the
> potential pitfalls of using self within closures (which I happen to think
> it does well). Unless and until a different way of calling out those
> pitfalls is proposed and accepted (as Andrew was suggesting), that point is
> an essential part of the discussion IMO.
>> And on the con side, I have heard --
> You forgot "Makes capture semantics of using self inside of closures less
> apparent." I consider this the main con of the current proposal, and it
> seems others do as well.

A means of preventing retain cycles due to closures should not be
limited to `self`. The same pitfalls apply to other variables.

    var obj = …
    obj.closure = {


More information about the swift-evolution mailing list