tuple-syntax

Dom DiSc dominikus at scherkl.de
Sun Mar 17 20:20:52 UTC 2024


I just viewed the D-Conf online talk about new syntax for tuples 
and had an idea I need to suggest:

One of the proposals was to use normal round brackets. But this 
would required to use something special to distinguish 
one-element tuples from from a parenthesized expression. It 
suggested a trailing comma for this case. But it has the second 
flaw that it remains unclear how to express an empty tuple 
unambiguously.

So, how about _always_ requiring a trailing comma?
This would make for a consistent syntax: (,) empty tuple, (x,) 
one-element tuple, (x,y,) two element tuple ...

Just an idea.


More information about the Digitalmars-d mailing list