Should we deprecate comma?

Steven Schveighoffer schveiguy at yahoo.com
Mon Mar 24 05:43:32 PDT 2014


On Mon, 24 Mar 2014 08:38:14 -0400, monarch_dodra <monarchdodra at gmail.com>  
wrote:

> On Monday, 24 March 2014 at 12:32:30 UTC, Steven Schveighoffer wrote:
>> On Sun, 23 Mar 2014 22:31:25 -0400, Andrei Alexandrescu In fact, if  
>> this was the case, I would use the comma operator more. How many times  
>> I have to change:
>>
>> if(cond)
>>    exp;
>>
>> into
>>
>> if(cond)
>> {
>>    exp;
>>    exp2;
>> }
>>
>> Would be nice to just do:
>>
>> if(cond)
>>    exp, exp2;
>>
>> -Steve
>
> //----
> if(cond)
>      {exp; exp2;}
> //----
>
> ?
>
> For what it's worth, it's what we do in our production code. And it's  
> safer. A copy paste that produces:
> //----
> if(cond)
>      exp; exp2;
> //----
>
> Can happen so fast, and is virtually un-catcheable unless it actually  
> breaks something.

I have an allergic reaction to braces on the same lines :) Only place I  
ever use them is when the whole function can fit on the same line.

-Steve


More information about the Digitalmars-d mailing list