Tuple literal syntax + Tuple assignment

Bruno Medeiros brunodomedeiros+spam at com.gmail
Fri Oct 29 09:58:02 PDT 2010


On 07/10/2010 19:45, Andrei Alexandrescu wrote:
> On 10/7/10 12:45 CDT, Michel Fortin wrote:
>> On 2010-10-07 12:34:33 -0400, Andrei Alexandrescu
>> <SeeWebsiteForEmail at erdani.org> said:
>>
>>> My suggestion is that we deprecate TypeTuple and we call it AliasTuple
>>> because that's really what it is - it's a tuple of stuff that can be
>>> passed in as an alias parameter.
>>
>> Personally, I like D built-in tuples; they're so simple. At the core
>> they're just a group of "things".
>
> They are terrible, awful, despiteful. They don't compose with anything;
> you can't have an array of tuples or a hash of tuples. They can't be
> returned a from a function. They spread their legs in function parameter
> lists without any control (flattening is bad, right?) Built-in tuples
> are the pitts. The one thing they're good for is as a back-end for
> std.typecons.Tuple.
>

In fairness, my impression is they were not meant to compose with 
anything or be returned with a function. They were created not as a 
first class type, but as a metaprogramming construct, whose purpose was 
*exactly* for capturing parameters for templates or functions and 
expanding them automatically. They were a great boon for D's 
metaprogramming capabilities.
As such they were not meant to emulate tuples as in Python's tuples, or 
any record type in general. But because they could partially be used as 
such, and because they share the same name, a lot of comparisons are 
made, which results in this idea that D's tuples are inferior.

This is not saying it would not be useful to have functionality like 
Python's tuples.

-- 
Bruno Medeiros - Software Engineer


More information about the Digitalmars-d mailing list