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

Stephen Celis stephen.celis at gmail.com
Thu Dec 17 07:22:37 CST 2015


> On Dec 17, 2015, at 4:54 AM, Jeremy Pereira via swift-evolution <swift-evolution at swift.org> wrote:
> 
> There are other ways to achieve the goal, for example Java has a warning that explicitly tells you when your local variable is shadowing an instance variable. Why wouldn’t that work?

The main arguments I've seen are around initializers and let-unwrapping:

    init(foo: Int) {
        self.foo = foo
    }

    guard let foo = foo else { return }

I'm curious if there are more. I think both of these could be special-cased.

Stephen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20151217/a63e5646/attachment.html>


More information about the swift-evolution mailing list