basic types and alias
Timon Gehr
timon.gehr at gmx.ch
Sun Feb 12 12:59:57 PST 2012
On 02/12/2012 09:44 PM, Walter Bright wrote:
> On 2/12/2012 11:27 AM, Timon Gehr wrote:
>> alias int I; // OK
>> template T(alias I){}
>> mixin T!int; // NG
>>
>> Is there any reason why we should not get rid of this inconsistency as
>> fast as
>> possible? What does not accepting basic types as template alias
>> parameters buy
>> anyone?
>
> alias parameters accept symbols. Keywords are not symbols.
I know what the status quo is. I was suggesting it might be a
sub-optimal design rooted in some arbitrary restriction that originated
from the compiler implementation. Therefore I was asking what the
rationale for such design would be.
Furthermore, alias declarations accept symbols and built-in types.
> To pass a type, just use template T(I).
The only workaround is to use template T(I...) if(I.length==1){}. Why
does it make sense to treat alias parameters differently from alias
declarations and tuple members? Why does it make sense to treat built-in
types differently from user-defined types in this case?
More information about the Digitalmars-d
mailing list