Should we deprecate comma?

Nick Treleaven ntrel-public at yahoo.co.uk
Mon Mar 24 07:32:35 PDT 2014


On 24/03/2014 13:10, monarch_dodra wrote:
> On Monday, 24 March 2014 at 12:43:22 UTC, Steven Schveighoffer wrote:
>> 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.

+1, I wish we could write:
T fun() => result;

Discussion here:
https://d.puremagic.com/issues/show_bug.cgi?id=7176

> I get that "allergic reaction" :)
>
> But it does have its advantages in terms of robustness (accidental ";"),
> and scaling. For example, there are cases where "," can't be used:
>
> Type myType;
> if(cond)
>      {int dummy = 5; initialize(myType, dummy);}

Here I would just use several lines for better readability. I would only 
use the comma for simple expressions that don't depend on each other:

if (cond)
	x=5, y=6;

> As a general rule, I feel that "{}" is ugly, but that once they are
> there, no-one is going to break my code.



More information about the Digitalmars-d mailing list