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

Chad J chadjoan at __spam.is.bad__gmail.com
Sat Oct 6 11:41:45 PDT 2012


On 09/23/2012 04:40 PM, 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

Might some of the ambiguity be reduced by defining special tokens for 
dereferencing tuple elements?

(int[]) a = ([1,2,3]);
assert(a[0]   == 1);
assert(a[[0]] == [1,2,3]);

I suspect that this would allow us to indulge in the attractive notion 
of single-element tuples.

Would the addition of such a token be considered heresy?


More information about the Digitalmars-d mailing list