[Issue 809] Should be possible to convert lazy argument to delegate

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu May 16 09:48:46 UTC 2019


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

Stewart Gordon <smjg at iname.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|WONTFIX                     |---

--- Comment #5 from Stewart Gordon <smjg at iname.com> ---
(In reply to RazvanN from comment #4)

I disagree.  If you have a lazy parameter, when you reference it in the
function you are saying "evaluate it at this point".  Essentially, a lazy
parameter is just syntactic sugar for a delegate, so it makes perfect sense to
be able to access said delegate.  I certainly can't see any reason not to allow
the programmer to do this.

(I realise you could effectively achieve this with a delegate literal:
int delegate() dg_ = { return dg; };
But can D compilers be relied on to optimise this to be the original delegate
rather than a wrapper?)

Furthermore, individuals shouldn't be marking bugs as WONTFIX just because they
personally disagree with them.  Let's see what Walter says.

--


More information about the Digitalmars-d-bugs mailing list