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

Stephen Celis stephen.celis at gmail.com
Fri Dec 4 17:23:12 CST 2015


On Fri, Dec 4, 2015 at 6:08 PM, David Hart <david at hartbit.com> wrote:

> Similarly, I rely on the ability to shadow things (including properties of
> self) a _lot_. And it's not just me; it's very common for e.g. initializers
> to use property names as the parameter names, such as:
>
>
> init(x: Int, y: Int) {
>     self.x = x
>     self.y = y
> }
>
>
> I agree with you on this, as I often use such idioms. That’s why the
> shadowing warning is not a good solution IMHO.
>

This is a fair point, though initialization seems to be the most common
exception and could be omitted from the rule.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20151204/657e8d96/attachment.html>


More information about the swift-evolution mailing list