refined sugar (was DMD 0.165 release)

Reiner Pope reiner.pope at REMOVE.THIS.gmail.com
Mon Aug 21 21:03:41 PDT 2006


kris wrote:
>> There already was (and is) in the form of { return exp; }. It's just 
>> not accepted - I can hardly count all the comments I get from people 
>> saying D didn't support this capability, and when I point out the { 
>> return exp; }, they frown like people do when you tell them broccoli 
>> is good for them.
I agree with this. I thought lazy evaluation in functional languages was 
a really cool feature, and although I knew it could be done with 
delegates in D, it seemed somehow wrong to me. An official rubber-stamp 
from the spec saying 'lazy evaluation is officially supported in D, 
using this syntax' breaks the mental block for me.
> 
> 
> Yes; would be nice to eliminate the return and the secondary ';' so it 
> looks like
> 
> # somefunk ({++i});
> #
> # rather than
> #
> # somefunk ({return ++i;});
> 
> Quite a difference, and both are still explicit rather than introducing 
> ambiguity. Or, use some kind of operator instead, like c# does?
> 
> # somefunk (=> ++i);
> 
> 

I think that something explicit, yet short, like this is good because it 
makes clear what is going on, while keeping the gee whiz factor because 
you can say, 'D supports lazy evaluation: look at the => (or whatever) 
operator'.



More information about the Digitalmars-d-announce mailing list