News for hackers. Stuff that matters.
Re:Go: Redefining For Loop Variable Semantics by masklinn on Tuesday October 11, 2022 @01:23PM (#33166083)
An equivalent construct works differently (and one would say in a way that is less error-prone) in other languages.

For instance the behaviour of a Python loop varies drastically depending on the size of the iteration:

     def loop(n):
         for i in range(n):
             pass
         print(i)

     loop(10) # 9
     loop(0)
     Traceback (most recent call last):
       File "<stdin>", line 1, in <module>
       File "<stdin>", line 4, in loop
     UnboundLocalError: local variable 'i' referenced before assignment
That Python works this way is specific to Python. And a language which doesn't have the issues this implies would be "getting it right", in the sense of avoiding sharp corners and edge cases.
Re:Go: Redefining For Loop Variable Semantics by jmconfuzeus on Tuesday October 11, 2022 @01:39PM (#33166303)
I see, it makes sense to force people to use different variables for iteration in that case because it can easily trip inexperienced developers up.