bearophile wrote:
Don:

Do you know why this semantics:

void add(Tulong)(Tulong x)   if ( is(Tulong == ulong) )

Is different from this one?

void add(Tulong:ulong)(Tulong x) {

This page says:
http://www.digitalmars.com/d/2.0/templates-revisited.html
T:int,        // T must be int type
So it seems the same as the version with the template constraint.

It isn't. It's the same as:

add(ulong x)
which leads to an ambiguity with add(long x).

Template constraints are considerably more powerful than template specialisation.


Can't the D2 semantics of (Tulong:ulong) be redefined to become the same of the 
version with template constraint if(is(Tulong==ulong)) to remove this special 
case from D?

Not without loss of capability.

Reply via email to