[swift-evolution] Proposal: 0009 Require self for accessing instance members
me at michael-brown.net
Thu Dec 17 12:02:54 CST 2015
> On 17 Dec 2015, at 17:54, Dan Loewenherz <dan at lionheartsw.com> wrote:
> On Thu, Dec 17, 2015 at 11:28 AM, Michael Brown via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
> On Tue, Dec 15, 2015 at 21:03 Sune Foldager via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
> > “self.” everywhere means you can see what’s an instance member and what’s a local variable. That’s generally a good thing. But it also means a lot of filler text in your code, which makes reading and writing slower. That’s not so good. It’s a balance, and in this case my experience from C# (and, as mentioned, Python) is that I much prefer C#’s non-mandatory use of “this”/“self".
> > I see that this proposal is going to be reviewed as SE-0009, and I am a bit concerned that not all arguments are being considered because of the contents of the proposal text: The only counter argument mentioned in the proposal has to do with capturing semantics in closures. This is fine, but why isn’t the counter argument of verbosity being mentioned? This has been brought up on the list as well.
> I couldn't agree more on all points. I strongly object to this proposal. Requiring self makes code unnecessarily verbose and is one of the things I least liked about Objective-C compared to other languages (e.g. C#, Python, Java) where the use of self/this is optional. It is only only actually necessary when resolving ambiguity with local variables, in the few situations where such ambiguity exists (initialisers mostly).
> Correction: self is not optional in Python.
Yes. I realized my mistake soon after I hit send. Apologies.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-evolution