Preliminary submission - std.rational and std.typelist
Jonathan M Davis
jmdavisProg at gmx.com
Sun Oct 7 21:16:55 PDT 2012
On Sunday, October 07, 2012 22:57:33 Arlen wrote:
> I can live with that, but, as I explained before, TypeTuples cause
> code duplication in certain cases because they force 'alias' to be
> used in the signature of the metafunctions.
>
> And how would you return a multi-dimensional TypeTuple? The result of
> certain metafunctions are multi-dimensional. For example,
> Permutations and Combinations will return multi-dimensional
> "containers".
>
> http://arlen.github.com/phobos/std_typelist2.html#Permutations
While this sort of function might be useful from time to time, how often is it
actually, realistically needed? Certainly, I'd argue that it's rare enough
that having a slightly more complicated solution specifically for it makes more
sense than adding a whole new abstraction to the standard library.
Adding something like TypeList on top of TypeTuple is generally overkill and
overcomplicates things. TypeTuple will do almost everything that TypeList can.
The question then is how to make TypeTuple do the parts that it can't
currently do or how to provide a reasonable, alternate solution for those rare
circumstances. Maybe a multi-dimensional wrapper for TypeTuple would be in
order to handle those cases?
Regardless, we previously decided that TypeList was unnecessary code
duplication and an unnecessary cognitive burden. Everything you add to the
standard library has a cost, even if it's valuable in and of itself, and
adding something very similar to something else which is already there is that
much worse, because then you have to understand the differences and constantly
explain them to those who don't know. So, we're not adding TypeList.
While I sympathize with your desire to get some of the functionality that
TypeList provides and TypeTuple doesn't, please work with us to improve upon
TypeTuple rather than trying to add something to Phobos that does almost the
same thing as TypeTuple. In most cases, it's simply a matter of adding the
appropriate templates to gain TypeList-like functionality on top of TypeTuple
rather than adding TypeList, and we've even recently added (post-2.060) some
of those templates to std.typetuple, thereby improving what can be done with
std.typetuple.
- Jonathan M Davis
More information about the Digitalmars-d
mailing list