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

Michel Fortin michel.fortin at michelf.ca
Tue Sep 25 10:45:50 PDT 2012


On 2012-09-25 16:38:31 +0000, "Jonathan M Davis" <jmdavisProg at gmx.com> said:

> On Tuesday, September 25, 2012 12:28:15 Michel Fortin wrote:
>> Although to make things less confusing, I think the built-in language
>> tuple should give up its name. It could become a "sequence". Renaming
>> the built-in one would certainly be less trouble, as code doesn't refer
>> to it by its name, and you can pick a name that fits better with its
>> auto-expanding behaviour.
> 
> Not referred to by its name? It's refereed to as TypeTuple all over the place.
> It's arguably a bad name, but it would break a _lot_ of code to change it now.

TypeTuple is only a construct allowing you to create a built-in 
language tuple, one that does not necessarily match the definition of a 
TypeTuple. The language spec defines a Tuples, TypeTuples, and 
ExpressionTuples with these words (ironically, using the word 
"sequence" twice):

"""
If the last template parameter in the TemplateParameterList is declared 
as a TemplateTupleParameter, it is a match with any trailing template 
arguments. The sequence of arguments form a Tuple. A Tuple is not a 
type, an expression, or a symbol. It is a sequence of any mix of types, 
expressions or symbols.

A Tuple whose elements consist entirely of types is called a TypeTuple. 
A Tuple whose elements consist entirely of expressions is called an 
ExpressionTuple.
"""
Source: http://dlang.org/template.html

-- 
Michel Fortin
michel.fortin at michelf.ca
http://michelf.ca/



More information about the Digitalmars-d mailing list