A Discussion of Tuple Syntax

captaindet 2krnk at gmx.net
Fri Aug 16 22:48:25 PDT 2013


On 2013-08-16 20:02, Meta wrote:
> On Friday, 16 August 2013 at 23:48:53 UTC, bearophile wrote:
>>> - #(a, b) is unambiguous and would probably be the easiest option. I don't think it looks too bad, but some people might find it ugly and noisy
>>
>> It looks nice (but I don't know if it's technically usable), I have added it at the end of the list of alternative syntaxes:
>> http://wiki.dlang.org/DIP32#Use_case_of_uniform_tuple_syntax
>
> Why do you say that? It seems to me that it would be better than {}, because there's only 1 other language construct that uses #, so there's little overlap with other features.

not sure what we are talking about here, new syntax for
a) TypeTuple (that would be my best guess but i am not sure)
b) std.typecons.Tuple
c) both, a unified syntax
the DIP is not completely clear about this either.

only case (a) is hot at the moment and i fell into some related pits recently myself. so i'd love to have a better syntax, one that makes the dirty hack (status quo) a proper part of the language - as it is widely used already and very powerful.

i am curious too if ..(..) constructs are completely out of the question. if not, i would suggest as shorthand:

	!(a,b)

this reminds of template instantiation and is exactly how the awkwardly/confusingly named TypeTuple is realized now, as an alias to its own template arguments. if we need a name for it, it should not remind at all of 'tuple' - since there is also the completely unrelated std.typecons.Tuple. a more verbose/explicit suggestion would be

	symbols(a,b)


/det


More information about the Digitalmars-d mailing list