> Technically, I believe a range loop variable can be used in a goroutine
>> safely. A very contrived example: https://play.golang.org/p/jgZbGg_XP6S .
>> In practice I can not see much use for this kind of pattern, but it does
>> exist.
>>
>
> It is correct that the range loop variable can be used
This is a very interesting and ambitious experiment! If successful, this is
getting at the type of evidence that would be useful when considering to
change the language.
When evaluating the change, we will need to find cases where the semantics
of the program might differ after the change. Semanti
Good point, and thanks for the response.
This example avoids the race condition by breaking out of the loop
immediately afterward. IIRC, loopclosure also reports in case the range
loop variable is passed as an argument using a name that shadows the loop
variable.
I think any loopclosure findings