DIP19: Remove comma operator from D and provision better syntactic support for tuples

Don Clugston dac at nospam.com
Mon Sep 24 01:17:49 PDT 2012


On 23/09/12 22:40, Andrei Alexandrescu wrote:
> I discussed this with Walter, and we concluded that we could deprecate
> the comma operator if it helps tuples. So I started with this:
>
> http://www.prowiki.org/wiki4d/wiki.cgi?LanguageDevel/DIPs/DIP19
>
> Unfortunately, I started much cockier than I ended. The analysis in
> there fails to construct a case even half strong that deprecating the
> comma operator could significantly help tuples. Well it essentially
> concludes that tuples are mostly fine as they are, and attempts to
> embellish them syntactically are marred with unexpected problems.
> Nevertheless, I sure have missed aspects all over, so contributions are
> appreciated.
>
>
> Thanks,
>
> Andrei

Regarding the comma operator: I'd love to deprecate it, but even if we 
don't, could we at least ensure that this kind of rubbish doesn't compile:

void main()
{
   int x;
   x > 0, x += 5;
}

At present, because comma expressions are expressions, not statements, 
the "x > 0" doesn't generate a "statement has no effect" error, despite 
the fact that it is meaningless and gets completely discarded.



More information about the Digitalmars-d mailing list