Should we deprecate comma?

monarch_dodra monarchdodra at gmail.com
Mon Mar 24 05:38:14 PDT 2014


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.


More information about the Digitalmars-d mailing list