<div dir="ltr">Hi all,<div><br></div><div>I understand the reasoning from both sides but this seems clearly something that don't gathers consensus from a majority of us and for that reason why should we really remove implicit self?</div><div><br></div><div>Swift supports both ways so there's an option to every one of us, no one is forced to use implicit self neither explicit self, its something that can (and should) be defined in each project as a convention to follow and possible enforce using a lint.</div><div><br></div><div>And if we're really considering removing implicit self to fix a few potential and hard to track bugs, we may also consider remove the ! operator to force unwrap an optional which is very unsafe unless verified first (!= nil) when we have a syntax, if let value = value {}, which safely unwraps the value and can potential prevent a lot of crashes.</div><div><br></div><div>It's only a figurative example to illustrate that is hard to achieve full correctness and while there are options you can choose the one that fits best to you.</div><div><br></div><div>David</div><div><br></div><div class="gmail_extra"><br><div class="gmail_quote">2015-12-15 22:46 GMT+00:00 Honza Dvorsky via swift-evolution <span dir="ltr"><<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span class="">Hi all,<br><br>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). <br><br>The disadvantages of this are only verbosity. But, from the design principles of Swift (as I understand them), correctness is preferred over making the language concise, especially when those two are in conflict, just like here. <br><br>I support the proposal, because it would lead to fewer bugs at only the cost of extra few characters. Again, I've been bitten by implicit self a couple times before and those bugs are hard to track down. And the readability of the code in code reviews, to me, is another huge advantage, possibly leading to more correctness bugs caught early. <br><br>I understand and appreciate the disadvantages, but again, I believe we should prefer correctness over conciseness, as explicitly stated by the Swift design principles. <br></span><div><div class="h5"><div class="gmail_quote"><div dir="ltr">On Tue, Dec 15, 2015 at 11:28 PM Slava Pestov via swift-evolution <<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Hi all,<br>
<br>
I don't see anyone lay out how this proposal can interact with nested types and such. There's a fair amount of complexity in Swift with what you can do by nesting things inside of each other, so the simple conceptual model of "locals are unqualified, instance variables have a self. prefix" doesn't seem to generalize.<br>
<br>
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.<br>
<br>
What about class methods that want to call each other? Do they need the explicit 'self', or an explicit class name prefix? The latter changes semantics if the class method is overridden in a subclass.<br>
<br>
If we ever add the ability for an inner type to capture stored properties from the outer type, how do you reference properties of the outer type? I guess the problem has to be solved anyway to refer to an outer "self" explicitly, but qualifying everything with OuterType.self.foo kind of defeats the purpose of inner types altogether.<br>
<br>
I'm not sure I buy the readability arguments in favor of this approach. It seems the languages where explicit 'self' was adopted did it mostly by accident, or because of implementation concerns. In Python for instance, there's no way for assignment to modify a binding in an outer scope, so 'foo = bar' always sets a local named 'foo', IIRC. So explicit self is needed there. Greg Parker explains earlier in this thread by explicit self was chosen for Objective-C, and it wasn't readability.<br>
<br>
Slava<br>
_______________________________________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
</blockquote></div>
</div></div><img src="https://u2002410.ct.sendgrid.net/wf/open?upn=UZ-2Fw3Bg8EOda-2F-2BSazO07kQ0r5nBosEb9Ga0vHTFIm-2BXIvL4gTDypuHJxwweV2MZ-2BzGlvFqln3hVA83V0VwATDcxW6sEXZhc6wUsHTcnIcIfiehfMkzv-2FIzhIrimrX-2FAfp4ngs4HD9zPNCe-2FRsfPh5PFttbgd9RfpbWhesJk7A9Pgadd77odpQLPQL7wEKmGzVUt-2F7ajALhNxKtq7HLsVdnxJQG55hO13Z9p13WcHxvU-3D" alt="" width="1" height="1" border="0" style="min-height: 1px !important; width: 1px !important; border-width: 0px !important; margin: 0px !important; padding: 0px !important;">
<br>_______________________________________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
<br></blockquote></div><br></div></div>