DIP54 : revamp of Phobos tuple types
monarch_dodra
monarchdodra at gmail.com
Mon Dec 23 05:50:26 PST 2013
On Monday, 23 December 2013 at 13:31:36 UTC, Dicebot wrote:
> On Monday, 23 December 2013 at 13:23:39 UTC, monarch_dodra
>> eg:
>> staticIndexOf(int, TemplateArgumentList!(int, double), int);
>>
>> Produces 1? 2? 3?
>> I really don't know.
>
> Compile-time error, new `staticIndexOf` will strictly accept 2
> template arguments - element and the list, similar to normal
> `indexOf`:
>
> template staticIndexOf(T...)
> if ((T.length == 2) && isTemplateArgumentList!(T[1]))
Ok... Then that'll break existing code that doesn't even *use*
TypeTuple... Seems lose-lose to me :/
In any case, let me re-write my question it as:
staticIndexOf(int,
TemplateArgumentList!(TemplateArgumentList!(int, double), int));
This time, its legal, right? What result does it create? Only the
"outer" TAL gets auto-expanded, right? Expanding the inner one
would seem wrong to me.
With that said, I can only image that the implementation of
templates that simply recurse would become very hard to imlement.
I see value in having a packed type with explicit auto-expand,
but I don't really see why it should replace the language's
built-in variadic type list.
More information about the Digitalmars-d
mailing list