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

Ash Furrow ash at ashfurrow.com
Tue Dec 15 16:16:18 CST 2015


Agreed – there are a few different disadvantages to adopting this new behaviour that aren’t discussed or mentioned at all. Especially considering the confusion from newcomers who do try to use the `let a = self.a` shortcut on value types…

Ash

On December 15, 2015 at 5:09:40 PM, Preston Sumner via swift-evolution (swift-evolution at swift.org) wrote:


I suspect people would use local variable boilerplates to circumvent mandatory self, as they do in Objective-C.

let a = self.a
let b = self.b
let c = self.c

// Actually do stuff with a, b, and c.

Preston

> On Dec 15, 2015, at 1:03 PM, sune.foldager--- via swift-evolution <swift-evolution at swift.org> wrote:
>  
> Personally, I am against using mandatory self. I have coded a lot of Python, and I find it quite annoying to have to type (and read) “self.” everywhere. It’s a balance, of course:
>  
> “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.
>  
> Also, the “Community Responses” section exclusively lists positive feedback. Is that how it’s supposed to be with the SE process? If not, where are the arguments from people who are -1 on the proposal?
>  
> I really hope the review team considers:
> - The negative responses on this list as well. Also consider that many Swift developers are not on this list; I doubt it’s representative, either, being dominated by “language interested” developers.
> - The rather large amount of changes to existing code required.
>  
> -Sune
>  
> _______________________________________________
> 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/20151215/3de3934e/attachment.html>


More information about the swift-evolution mailing list