refined sugar (was DMD 0.165 release)

BCS BCS at pathlink.com
Mon Aug 21 20:11:06 PDT 2006


kris wrote:
> Walter Bright 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.
> 
> 
> 
> 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 second this. I'm not sure that syntax would be best but some sort of 
/explicit/ syntax to make an expression into a delegate (a /shorthand/ 
for the {return exp;}, not another "convention") would be much less 
confusing.


options: (Just off the top of my head)

op Expression
op ( Expression )

op == one of: "&", "@", "^", "$", "\"


The &(exp) form looks interesting:

	"take the address of this R-value".

Kinda sounds right. Have to think on that.




More information about the Digitalmars-d-announce mailing list