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





------- Comment #7 from shro8...@vandals.uidaho.edu  2009-05-05 15:16 -------
(In reply to comment #6)
> (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.

fair enough complaint

> 
> (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.
> 

I can't prove it but I'd bet this is the same thing: the expression "okay" is
begin converted to "okay()" via the no perens rule. so for dg on the inside you
get:

delegate void(){ okay(); }


-- 

Reply via email to