Re: About template template arguments syntax

2011-10-02 Thread Philippe Sigaud
On Sun, Oct 2, 2011 at 23:25, David Nadlinger wrote: > By the way, the issue here is the builtin primitive types are not considered > symbols, user-defined types are matched by alias. That's because user-defined types have a name, I guess. So alias catches the name, not the underlying types (if

Re: About template template arguments syntax

2011-10-02 Thread David Nadlinger
On 10/2/11 9:19 PM, Timon Gehr wrote: template isSymbol(alias T){ enum isSymbol=true; } template ID(T){alias T x;} void main(){ bool mooh=isSymbol!(ID!int); } Well, that should be fixed. By the way, the issue here is the builtin primitive types are not considered symbols, user-defined types

Re: About template template arguments syntax

2011-10-02 Thread Timon Gehr
On 10/02/2011 08:48 PM, Philippe Sigaud wrote: On Sun, Oct 2, 2011 at 19:12, Timon Gehr wrote: Types are symbols, so just using alias template arguments works. Hmm, no. template isSymbol(alias a) { enum isSymbol = true; } void main() { enum a = isSymbol!int; } Error: template i

Re: About template template arguments syntax

2011-10-02 Thread Philippe Sigaud
On Sun, Oct 2, 2011 at 19:12, Timon Gehr wrote: > Types are symbols, so just using alias template arguments works. Hmm, no. template isSymbol(alias a) { enum isSymbol = true; } void main() { enum a = isSymbol!int; } Error: template instance isSymbol!(int) does not match template decl

Re: About template template arguments syntax

2011-10-02 Thread Timon Gehr
On 10/02/2011 02:44 PM, Philippe Sigaud wrote: On Sun, Oct 2, 2011 at 04:20, bearophile wrote: This little program is a reduction of code recently shown around here: template Spam(T, alias P) { enum Spam = P!T; } template Foo(T, Preds...) { enum bool Foo = Spam!(T, Preds[0]); } template B

Re: About template template arguments syntax

2011-10-02 Thread bearophile
Philippe Sigaud: > Because P is a template name, not a type. 'Bar' is not a type, it's a > template: a blueprint for producing code. Symbols, can only be > manipulated in D through aliases (though it's cool they can be > manipulated at all!) So the need to add "alias" there allows some static typ

Re: About template template arguments syntax

2011-10-02 Thread Philippe Sigaud
On Sun, Oct 2, 2011 at 04:20, bearophile wrote: > This little program is a reduction of code recently shown around here: > > > template Spam(T, alias P) { enum Spam = P!T; } > template Foo(T, Preds...) { >    enum bool Foo = Spam!(T, Preds[0]); > } > template Bar(T) { enum Bar = true; } > static a

About template template arguments syntax

2011-10-01 Thread bearophile
This little program is a reduction of code recently shown around here: template Spam(T, alias P) { enum Spam = P!T; } template Foo(T, Preds...) { enum bool Foo = Spam!(T, Preds[0]); } template Bar(T) { enum Bar = true; } static assert(Foo!(int, Bar)); void main() {} Do you know why the P ar