de facto keywords

Janice Caron caron800 at googlemail.com
Sat Apr 5 08:02:43 PDT 2008


On 05/04/2008, Paul D. Anderson
<paul.d.anderson.removethis at comcast.andthis.net> wrote:
>  "tuple" -- The use of tuples is ubiquitous in D. There is a a "tupleof" property for structs and unions. The "foreach" keyword knows about them. Yet there is no syntactic support for the thing itself. It is confusing to be required to define a template to access something the compiler creates. This may be just syntactic sugar but it's necessary sugar, IMHO.

In fact, the word "tuple" is ambiguous in D. If you believe the
article "Tuples" on the digitalmars website then a tuple is a sequence
of a mix of types and values, whereas if you believe the documentation
for std.typecons then a Tuple! is an aggregate of values (so that a
function can return multiple values, for example).

In all computer languages of which I am aware, the word "tuple"
normally has the latter meaning. The former meaning is perhaps better
described by the phrase "variadic template arguments". I have
submitted a bug report pointing out the ambiguity, and maybe the
documentation should be fixed one day.



More information about the Digitalmars-d mailing list