How to avoid variable capturing in `foreach` loop with lambdas?

bauss jacobbauss at gmail.com
Mon Jan 9 11:31:21 UTC 2023


On Monday, 9 January 2023 at 00:19:39 UTC, thebluepandabear wrote:
>> Fixing this will improve the quality of the language for 
>> newcomers such as myself greatly.
>
> This not only confuses newcomers but it gave a false illusion 
> of a bug within the code :/

It doesn't confuse newcomers only, also people who have used D 
for over a decade like me :) Mostly because it's not a thing in 
most (if not all) other languages.

I think D is unique in that aspect.

It should be fixed however, I don't think the current behavior is 
correct or expected by anyone.


More information about the Digitalmars-d-learn mailing list