DIP54 : revamp of Phobos tuple types
Philippe Sigaud
philippe.sigaud at gmail.com
Tue Dec 24 01:06:40 PST 2013
On Mon, Dec 23, 2013 at 7:34 PM, Andrej Mitrovic
<andrej.mitrovich at gmail.com> wrote:
> I'm waiting to see what others who use TypeTuples think of the DIP.
> E.g. Philippe Sigaud, David Nadlinger, Hara Kenji, Martin Nowak, Don
> Clugston, David Simcha, Steven Schveighoffer, etc. I'm pretty sure
> (most) of these guys use tuples a lot.
Much as I like non-expanding tuples, I've to admit most of the
standard uses of tuples (er, template argument lists) are easier if
they auto-expand/flatten.
I agree there are symbols that should be renamed to avoid confusion,
so I agree with the renaming part.
As for non-expanding, I tend to create my own (any template struct
will do), but std.typecons.Tuple is perfectly serviceable.
My main use is to create trees: lists are good, but there are
structures that need a bit more... oomph. For example:
auto myBox =
computer(
processor(
cores(4),
speed(3500.Hz),
Processor.i586
),
disk(
size(500.TiB)
),
disk(
size(750.TiB),
speed(7200.rpm),
Disk.SATA
),
screen()
);
When everything above returns a new type, possibly holding other
types, and so on. The resulting type is one big tuple of tuples. I
think those could be a possible way to get an internal DSL in D, at
the same time statically checked by the compiler and easy to use for
the programmer.
So I need generic code to iterate on it, process it, modify it... But,
as I said in that case, I create my own structs.
More information about the Digitalmars-d
mailing list