View mode: basic / threaded / horizontal-split · Log in · Help
March 19, 2006
Re: SDWest paper "Templates Revisited" now available
John Demme wrote:
> Walter Bright wrote:
> "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
Template specialization rules and alias parameters.
Both in the D doc, and in
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
Next ›   Last »
1 2
Top | Discussion index | About this forum | D home