[Issue 21929] delegates capture do not respect scoping

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu May 20 07:53:22 UTC 2021


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

a11e99z <black80 at bk.ru> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |black80 at bk.ru

--- Comment #7 from a11e99z <black80 at bk.ru> ---
agree with bug.

man creating new delegate/lambda with new internal state. 
what is reason to store just one shared state for created multiple delegetes in
loop? what is using case for it?

if D-team don't want to break current behavior let add new keyword "lambda"
that is 100% compatible with "delegate" but it grabs totally new state when
created - just changed compile time generated code.

C++ byRef & byValue capturing is more viable.

--


More information about the Digitalmars-d-bugs mailing list