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

Ilya Belenkiy ilya.belenkiy at gmail.com
Wed Dec 16 07:03:40 CST 2015


+1 for keeping self optional and the argument.

--
Ilya Belenkiy
On Wed, Dec 16, 2015 at 7:48 AM Stephen Celis via swift-evolution <
swift-evolution at swift.org> wrote:

> > On Dec 15, 2015, at 5:28 PM, Slava Pestov via swift-evolution <
> swift-evolution at swift.org> wrote:
> >
> > Will I need to qualify associated types with the protocol or type name
> to refer to them? What about generic type parameters, they're sort of like
> "instance variables" too.
>
> Hadn’t thought about that. It does seem that requiring “Self.” would be a
> natural extension of this proposal.
>
> > On Dec 15, 2015, at 5:46 PM, Honza Dvorsky via swift-evolution <
> swift-evolution at swift.org> wrote:
> >
> > I've been following the thread from the beginning and some great
> arguments have been layed out. As far as I understand, this proposal would
> lead to fewer correctness bugs (referring to a different variable due to
> implicit self, has happened to me twice in the last couple of months, was
> very hard to track down).
>
> It sounds to me that the biggest advantage of requiring self is to avoid
> the occasional , hard-to-find bug (at the cost of muddying the readability
> of a lot of code). I’d much rather focus on improving compiler diagnostics
> and error messaging than limit the expressiveness of the language.
>
> With the current discussion having a lot of voices on both sides, I can’t
> imagine this proposal passing, especially when a linter could easily
> enforce such a rule for the audience that prefers it.
>
> Stephen
> _______________________________________________
> 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/20151216/ed21c974/attachment.html>


More information about the swift-evolution mailing list