[Issue 2043] Closure outer variables in nested blocks are not allocated/instantiated correctly: should have multiple instances but only have one.

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sat May 2 01:12:29 PDT 2015


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

--- Comment #23 from Artem Borisovskiy <kolos80 at bk.ru> ---
(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.
> 
> 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.

Well, if you think it's the most practical solution, then would you kindly
provide us with a couple of examples showing the solution from different
angles? It isn't clear how it solves the problem.

--


More information about the Digitalmars-d-bugs mailing list