DIP54 : revamp of Phobos tuple types

John Colvin john.loughran.colvin at gmail.com
Sun Dec 29 07:12:54 PST 2013


On Sunday, 29 December 2013 at 15:01:03 UTC, Andrei Alexandrescu 
wrote:
> On 12/29/13 3:09 AM, Dicebot wrote:
>> 1)
>> Timon has raised the point that exact match between in naming 
>> between
>> built-in and library type will be confusing as they will 
>> actually differ
>> in behavior 
>> (http://forum.dlang.org/post/l99mke$q1o$1@digitalmars.com).
>> Andrei has proposed `TemplateArgumentPack` as an alternative
>> (http://forum.dlang.org/post/l9b5cu$2rsj$2@digitalmars.com) 
>> which I do
>> like a lot.
>>
>> That will also imply naming of module `std.meta.pack` instead 
>> of
>> `std.meta.list`
>
> I think a duo `TemplateArgumentList` (auto-expansion) and 
> `TemplateArgumentPack` (no auto-expansion) in the same module 
> is the ticket. It also makes for a wonderful opportunity to 
> explain the distinction in the documentation and recommend 
> idioms for each.

This is the approach I have followed when trying to write 
std.meta, however I decided to split them in to two seperate 
modules. Then again, my module layout is a mess and I will 
probably rearrange considerably before submitting to the review 
queue.

The recommended idioms drop out very neatly: 
`TemplateArgumentList` is for genuine variadic template arguments 
(where possible), `TemplateArgumentPack` is for everything else. 
In particular, with a (nearly)full port of std.range and 
std.algorithm, TemplateArgumentPacks can be used as an analogue 
of arrays.


More information about the Digitalmars-d mailing list