[swift-evolution] Hidden initiallizations ...
Andrey Tarantsov
andrey at tarantsov.com
Tue Mar 29 06:39:08 CDT 2016
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 <bialata at yahoo.com> 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 <andrey at tarantsov.com> 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.
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160329/74742f49/attachment.html>
More information about the swift-evolution
mailing list