https://issues.dlang.org/show_bug.cgi?id=2043

--- Comment #24 from [email protected] ---
(In reply to Walter Bright from comment #21)
> The most practical solution is to simply disallow referencing variables from
> a dynamic closure that end sooner than the closing } of the function.
> 

Why? Lexical scoping exists for a reason.

> This leaves it up to the user to decide how to handle it, such as passing
> the variable explicitly as an argument, declaring the variable at function
> scope, or copying the variable to another declared at function scope.

It's up to the user anyway. Mandating the workaround may be the easiest to
implement, but it certainly isn't the right thing to do.

Of course, your suggestion might be implemented (*only for local scopes inside
loops, please*) as a temporary fix for type system unsoundness, but don't
assume that this will fix this issue.

--

Reply via email to