<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Dec 14, 2015 at 10:32 AM, Dave Abrahams via swift-evolution <span dir="ltr"><<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""><br>
> On Dec 14, 2015, at 7:29 AM, Jeremy Pereira via swift-evolution <<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>> wrote:<br>
><br>
>><br>
>> On 14 Dec 2015, at 09:01, Andrew Brown via swift-evolution <<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>> wrote:<br>
>><br>
>> This discussion isn't going to be solved quickly so +1 for a compiler flag.<br>
>> I'd propose the flag generates an error if member variables are accessed without self.<br>
><br>
> 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.<br>
<br>
</span>Please consider that individually-selectable warnings have a tendency to do the same thing.<br><br></blockquote><div><br></div><div>Agreed. This should not be a warning. There should be a correct way to reference global functions, constants, variables, methods, and properties. If leading "self." or punctuation is recommended, it should be required. If scopes should have no distinction, then adding unnecessary "self" should be discouraged at a minimum, not encouraged with an optional warning.</div><div><br></div><div>I prefer a distinction for methods and properties (specifically I prefer punctuation), but I currently drop all unnecessary "self." because consistency is more critical than preference, and Apple's sample code doesn't use "self." except where required. Adding warnings makes it very hard to share code that was written by different teams with different opinions. It is better to bend than splinter.</div><div><br></div><div>But I do find that the current system (where a property looks like a local variable and a method looks just like a global function) makes code review harder in the tools that code review is usually done with (which are web browsers, email and chat sessions, not editors or IDEs). Since I believe that code review is second only to strong types in reducing bugs, I want code review to be as easy as possible. So I advocate a distinction, and think punctuation (particularly :x) is the lightest-weight solution.</div><div><br></div><div>But please, no warnings. There should be a single approach for stdlib, and that approach should be what we all use.</div><div><br></div><div>-Rob</div></div><div class="gmail_signature"><div dir="ltr"></div></div>
</div></div>