Less commas

Peter Alexander peter.alexander.au at gmail.com
Fri Dec 31 04:45:16 PST 2010


On 31/12/10 8:09 AM, bearophile wrote:
> I'd like to restrict a bit the usage of the comma operator in D2, disallowing at compile-time some currently usages that some C style guides already suggest to avoid.
>
> If I see production code like the two examples below in production code, I change the code, and remove the commas. I think they are confusing, and may hide bugs. Do you know other situations where you like to disallow the comma operator in D2? Later I will probably write an enhancement request on this.

I don't believe it is the job of the compiler to enforce personal style 
preferences.

If people /really/ want to write obfuscated code then that's up to them 
-- you can't stop them. If organisations want to enforce style guides 
then that's up to them to manually enforce the style or produce tools to 
do it automatically.

Whatever criteria you select for distinguishing acceptable comma use 
from unacceptable comma use will be subjective, and inevitably some 
people will be angered by the decision.

I think that this should be *at most* an optional warning, but even then 
I think it would be a massive waste of programmer time to add this feature.




More information about the Digitalmars-d mailing list