New in C#4

Ary Borenszweig ary at esperanto.org.ar
Wed Oct 29 13:49:53 PDT 2008


bearophile escribió:
> Denis Koroskin:
> 
>> graphicsDevice->updateSettings(fullScreen: true, verticalSync: true,  
>> enableBloom: false, fullScreenAA: true);
> 
> Seeing this, now I think the syntax with equals is a little shorter, so maybe I prefer the equals:
> 
> graphicsDevice->updateSettings(fullScreen=true, verticalSync=true,  
> enableBloom=false, fullScreenAA=true);

You didn't just replace ":" for "=", you also removed spaces! :P

graphicsDevice->updateSettings(fullScreen:true, verticalSync:true, 
enableBloom:false, fullScreenAA:true);

graphicsDevice->updateSettings(fullScreen=true, verticalSync=true, 
enableBloom=false, fullScreenAA=true);

See? Now they are the same length.

It's not a matter of preference in D, because "a=b" is an expression, so 
"=" can't be used for named arguments. I think ":" can, because that is 
used in statements... and in ?:, but there would be no ambiguities there.



More information about the Digitalmars-d mailing list