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:20:54 PDT 2012


On 09/24/2012 11:55 AM, Caligo wrote:
> If tuples are ever introduced, I hope parentheses will not be used.
>
> I would prefer something like this:
>
> tuple<2,1,8>

Not using parentheses: a possibly valid idea!

Using angle brackets: never going to happen.

People HATE angle brackets.  There is extremely good justification for 
this hatred, because C++ already stepped on that landmine and suffered 
dearly for it.

If you were to use angle brackets, then I would try to do this:
tuple<a>b,c> d
Which way should this be parsed?
It might be a value tuple of type <bool,bool>
or it might be a declaration: d is of type <bool, typeof(c)>

It is very easy to create cases with angle brackets that are 
syntactically ambiguous and make it impossible to parse code as a 
context-free-grammar.  It is harder, but probably possible, to create 
cases where such a syntax is also completely ambiguous semantically too.



More information about the Digitalmars-d mailing list