New in C#4

Jesse Phillips jessekphillips at gmail.com
Wed Oct 29 22:15:20 PDT 2008


On Wed, 29 Oct 2008 18:49:53 -0200, Ary Borenszweig wrote:

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

His point was that after typing ':' he will usually put a space. I don't 
really understand this argument, as I know of people that will complain 
when spaces aren't put around ' = '.

I do like the idea of name the arguments in the call for readability. I 
don't think it should be mandatory, nor do I believe anyone has suggested 
that.



More information about the Digitalmars-d mailing list