http://d.puremagic.com/issues/show_bug.cgi?id=2939





------- Comment #6 from jarrett.billings...@gmail.com  2009-05-05 14:52 -------
(In reply to comment #5)

> What is happening in the original cases is that the 'dg();' is evaluating *to
> the* lambda rather than *evaluating* the lambda. And this is correct as the
> expression that f was called with is the lambda. (If there is a problem here 
> is
> it the old one of the skipping the perens on void functions thing)
> 
> To look at it another way, dg is (almost):
> 
> delegate void(){ return delegate void(){ ok = true; } }

Yes, I'm pretty sure that's what's happening.  But there are two issues:

(1) It's extremely counterintuitive, easy to forget, and when you invariably
get bitten by it, the compiler and runtime give no help diagnosing the problem.

(2) Why does passing a delegate reference work, but not a lambda?  They are
*the same type* and you'd expect the compiler to do *the same thing* with both.


-- 

Reply via email to