News for hackers. Stuff that matters.
Re:Go: Redefining For Loop Variable Semantics by Semaphor on Tuesday October 11, 2022 @09:21AM (#33163035)
If I do the same with for instead of foreach in C#, my IDE gives me a warning: "Captured variable is modified in the outer scope". Isn’t that the case for Python?
Re:Go: Redefining For Loop Variable Semantics by ketzu on Tuesday October 11, 2022 @09:43AM (#33163261)
Copy pasting OPs code to pycharm: No warning.
Re:Go: Redefining For Loop Variable Semantics by Semaphor on Tuesday October 11, 2022 @09:47AM (#33163309)
Probably worthy of a YouTrack report ;)
Re:Go: Redefining For Loop Variable Semantics by jstx1 on Tuesday October 11, 2022 @10:46AM (#33163970)
Re:Go: Redefining For Loop Variable Semantics by maxloh on Tuesday October 11, 2022 @02:27PM (#33167078)
I don't think it is a good practice to capture it in lint tooling, instead of by the language itself.
Re:Go: Redefining For Loop Variable Semantics by Semaphor on Tuesday October 11, 2022 @10:18PM (#33171964)
It’s what linters are great at, catch things that work the way you don’t expect.