> On May 18, 2016, at 1:43 PM, Krystof Vasa <[email protected]> wrote:
> 
> See my example with the tableView and the UITableViewDelegate on 
> UITableViewController. `if let x = x` isn't the usual case. The usual case is 
> that you have e.g. tableView instance on the class and a method that takes a 
> tableView parameter.
That would be shadowing.

> Then you change the method signature not to include the parameter and the 
> code still compiles, since the tableView reference now goes to the instance 
> variable, which is wrong.
If the annotation/keyword behaved similar to ‘override’, then you would either 
have a shadowing warning before saying that there was shadowing, or afterward 
saying that you are using the annotation/keyword when shadowing isn’t happening.

> 
> I agree that shadowing variables is not a good idea, but I stand by my point 
> that it's potentially dangerous and error-prone to allow accessing instance 
> variables without `self`.
> 
> Krystof
> 

-DW
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to