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

crk at fastmail.com crk at fastmail.com
Mon Dec 14 13:01:28 CST 2015


I believe Chris stated he was fine with options that enforced existing syntax, just not ones that changed the grammar.

In this case, code would compile without the flag regardless of whether or not it was originally written with the flag.

I believe it was also stated that some sort of attribute in the file was preferred over a compiler flag, which definitely seems like a good idea to me.


On Dec 14, 2015, 09:29 -0600, Jeremy Pereira via swift-evolution<swift-evolution at swift.org>, wrote:
>  
> > On 14 Dec 2015, at 09:01, Andrew Brown via swift-evolution<swift-evolution at swift.org>wrote:
> >  
> > This discussion isn't going to be solved quickly so +1 for a compiler flag.
> > I'd propose the flag generates an error if member variables are accessed without self.
>  
> I’d propose it only be a warning. The reason for this is that Chris Lattner, in an unrelated thread, expressed an aversion to compiler flags that create different dialects of the language and I agree with him.
>  
>  
> > Then after some time we can survey the community (or scan GitHub) to see how many people use the flag.
> > (making it a preference in Xcode would also help)
> >  
> > ABR.
> >  
> > > On 14 Dec 2015, at 07:12, David Hart via swift-evolution<swift-evolution at swift.org>wrote:
> > >  
> > >  
> > > > On 13 Dec 2015, at 22:45, Charles Srstka via swift-evolution<swift-evolution at swift.org>wrote:
> > > >  
> > > > Since opinions seem to be divided on this, how about adding an optional warning flag to the compiler, which would warn if one accessed an instance variable or method without self. in front?
> > >  
> > > That is a good alternative.
> > > _______________________________________________
> > > swift-evolution mailing list
> > > swift-evolution at swift.org
> > > https://lists.swift.org/mailman/listinfo/swift-evolution
> > _______________________________________________
> > swift-evolution mailing list
> > swift-evolution at swift.org
> > https://lists.swift.org/mailman/listinfo/swift-evolution
>  
> _______________________________________________
> 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/20151214/faaa60d8/attachment.html>


More information about the swift-evolution mailing list