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

Pierre Monod-Broca pierre at monod-broca.fr
Mon Dec 14 02:15:49 CST 2015


+1 on a way to tell the compiler to warn the developper (a cli flag or a compiler directive in the file)

Pierre

> Le 14 déc. 2015 à 09:01, Andrew Brown via swift-evolution <swift-evolution at swift.org> a écrit :
> 
> 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.
> 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



More information about the swift-evolution mailing list