This is idiomatic Swift. I see no readability issues with that.

Of course, shadowing a local var with a for loop counter is another case. I'd 
say a warning is warranted there.

A.


> On Mar 29, 2016, at 5:30 PM, Biala <[email protected]> wrote:
> 
> And you are OK with that ????
> I can not imagine my team writing such code and me looking to 5 code reviews 
> per day having to find out what the variable actually is every time :)
> 
> For me it is OK for student projects but not for big code that have to be 
> supported for years ...
> 
> 
> On Tuesday, March 29, 2016 2:02 PM, Andrey Tarantsov <[email protected]> 
> wrote:
> 
> 
>> Having more that one variable with the same name in one method is stupid and 
>> the language should prevent that at least. 
> 
> Actually, we're doing it all the time:
> 
> if let foo = foo {
>   ...
> }
> 
> var foo = foo
> 
> You can do this in a subscope, you can do this to the arguments, and you can 
> do this to fields.
> 
> A.
> 
> 
> 

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

Reply via email to