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

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu May 16 11:06:37 UTC 2019


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

--- Comment #6 from RazvanN <razvan.nitu1305 at gmail.com> ---
(In reply to Stewart Gordon from comment #5)
> (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?)
> 
You can do pragma(inline) int delegate() dg_ = { return dg; };

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

I interpreted Walter's comment and replied as an extension to his first
comment.

--


More information about the Digitalmars-d-bugs mailing list