March 19, 2006
John Demme wrote:
> Walter Bright wrote:
> 
>> www.digitalmars.com/d/templates-revisited.html
> 
> "Printf Revisited".... "Templates Revisited"... Will your book on D
> programming be called "Programming Revisited"?
> 
> Good stuff, BTW.  I may be doing your NW C++ presentation for my LUG here at
> University of Maryland, and follow it up with this one.
> 
> ~John Demme

That would be fantastic, I think if we could all do things like this it would really help to evangelize.
April 09, 2006
Both in the D doc, and in
www.digitalmars.com/d/templates-revisited.html
the rules about template specialization are omissive about alias parameters. I think a clarification is important, even more because the actual behavior seems a bit strange to me. See the code below.


class Foo { }	
	
class FooBar : Foo {}

template Xpto(T:FooBar) {
  int a = 1;
}

template Xpto(alias T) {
  int a = 2;
}

template Xpto(T:Foo) {
  int a = 3;
}

template Xpto(T) {
  int a = 4;
}

int main(char[][] args)
{
  writefln( Xpto!(FooBar).a );
}


The templates are shown ordered according to the order of preference in which they are chosen to specialize the Xpto!(FooBar) instance. As you can see the alias parameter is in the middle of the preference order, which seems strange to me. Shouldn't it be the first, or the last? (the last more likely, since it is less specific than a type parameter)

-- 
Bruno Medeiros - CS/E student
http://www.prowiki.org/wiki4d/wiki.cgi?BrunoMedeiros#D
1 2
Next ›   Last »