[Issue 11044] Escaping references to lazy argument are allowed and compile to wrong code

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Jun 5 11:22:52 UTC 2023


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

Vladimir Panteleev <dlang-bugzilla at thecybershadow.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
                 CC|                            |dlang-bugzilla at thecybershad
                   |                            |ow.net
         Resolution|WONTFIX                     |---

--- Comment #8 from Vladimir Panteleev <dlang-bugzilla at thecybershadow.net> ---
(In reply to Walter Bright from comment #5)
> I have a dip in the works to deprecate lazy parameters, replacing them with
> delegates, precisely because of problems like this. So this particular issue
> will likely not get fixed.

Looks like this was not an easy decision to make, as the situation is unchanged
three years later. I think we should at least do something about bugs like this
in the meantime - the compiler should either reject such constructs or not
generate bad code for them.

Personally I am skeptical that lazy can be removed from the language at this
point, because for one thing doing so will break std.exception.enforce, and
make it impossible to wrap or implement assert in user code. As far as I can
see, we have no choice but to support it as part of the language going forward.

--


More information about the Digitalmars-d-bugs mailing list