www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.announce - DMD 0.124

reply "Walter" <newshound digitalmars.com> writes:
I'm not too sure about iftype. Let's see how it goes. Consider it
'experimental' for now.

http://www.digitalmars.com/d/changelog.html
May 19 2005
next sibling parent reply Geert <gertje gertje.org> writes:
iftype?!?!! WOW!!! I like it!!!

Walter wrote:
 I'm not too sure about iftype. Let's see how it goes. Consider it
 'experimental' for now.
 
 http://www.digitalmars.com/d/changelog.html
 
 
 
May 19 2005
parent reply James Dunne <james.jdunne gmail.com> writes:
Link to std.boxer page produces digitalmars' homepage in both the ChangeLog and
the Phobos page ;)

In article <d6iob7$2daa$1 digitaldaemon.com>, Geert says...
iftype?!?!! WOW!!! I like it!!!

Walter wrote:
 I'm not too sure about iftype. Let's see how it goes. Consider it
 'experimental' for now.
 
 http://www.digitalmars.com/d/changelog.html
 
 
 
Regards, James Dunne
May 19 2005
parent "Walter" <newshound digitalmars.com> writes:
"James Dunne" <james.jdunne gmail.com> wrote in message
news:d6ioom$2dok$1 digitaldaemon.com...
 Link to std.boxer page produces digitalmars' homepage in both the
ChangeLog and
 the Phobos page ;)
Fixed.
May 19 2005
prev sibling next sibling parent reply bobef <bobef_member pathlink.com> writes:
I don't like the syntax and it's name. I, personaly, like something like

if ( var.typeof == int)

or even

if ( var.typeof : int)

but not

iftype ( var : int)


In article <d6imvd$2c53$1 digitaldaemon.com>, Walter says...
I'm not too sure about iftype. Let's see how it goes. Consider it
'experimental' for now.

http://www.digitalmars.com/d/changelog.html
May 19 2005
parent Geert <gertje gertje.org> writes:
It's name?? William Shakespeare wrote:

'Tis but thy name that is my enemy;
Thou art thyself, though not a Montague.
What's Montague? it is nor hand, nor foot,
Nor arm, nor face, nor any other part
Belonging to a man. O, be some other name!
*What's in a name?* that which we call a rose
By any other name would smell as sweet;
So Romeo would, were he not Romeo call'd,
Retain that dear perfection which he owes
Without that title. Romeo, doff thy name,
And for that name which is no part of thee
Take all myself.

bobef wrote:
 I don't like the syntax and it's name. I, personaly, like something like
 
 if ( var.typeof == int)
 
 or even
 
 if ( var.typeof : int)
 
 but not
 
 iftype ( var : int)
 
 
 In article <d6imvd$2c53$1 digitaldaemon.com>, Walter says...
 
I'm not too sure about iftype. Let's see how it goes. Consider it
'experimental' for now.

http://www.digitalmars.com/d/changelog.html
May 19 2005
prev sibling next sibling parent reply "Kris" <fu bar.com> writes:
Calling through interfaces is broken in 0.124 and 0.123; perhaps not all
uses, but enough to trash the core of the Mango libraries. Dmd 0.121 is
good, as are prior versions all the way back to 0.8x something. There's a
post in the buglist.


"Walter" <newshound digitalmars.com> wrote in message
news:d6imvd$2c53$1 digitaldaemon.com...
 I'm not too sure about iftype. Let's see how it goes. Consider it
 'experimental' for now.

 http://www.digitalmars.com/d/changelog.html
May 19 2005
parent "Walter" <newshound digitalmars.com> writes:
"Kris" <fu bar.com> wrote in message news:d6iq1n$2esk$1 digitaldaemon.com...
 Calling through interfaces is broken in 0.124 and 0.123; perhaps not all
 uses, but enough to trash the core of the Mango libraries. Dmd 0.121 is
 good, as are prior versions all the way back to 0.8x something. There's a
 post in the buglist.
Thanks. I'll try and figure out what went wrong.
May 19 2005
prev sibling next sibling parent Dejan Lekic <leka entropy.tmok.com> writes:
Walter, thanks for everything... We all really DO apriciate Your enormous
work...
I do not know D internals, and cannot help with D due to lack of
time/knowledge, but I did maybe one good thing for D - attached is a BASH
script I am using to easily install D on my Linux box.

User simply runs ./install.sh 124 and script will connect to
digitalmars.com, download package, unpack and install files in proper
places.

I'll put it on my web-server these days so users can do something
like /bin/sh `lynx -source http://.../install.sh` 125 , and use remote
script to quickly install new (old versions too) version ...

I hope somebody will find this usefull.

-- 
...........
Dejan Lekic
  http://dejan.lekic.org
  
May 19 2005
prev sibling next sibling parent reply "Charlie" <charles jwavro.com> writes:
Site looks great!

Charlie
"Walter" <newshound digitalmars.com> wrote in message
news:d6imvd$2c53$1 digitaldaemon.com...
 I'm not too sure about iftype. Let's see how it goes. Consider it
 'experimental' for now.

 http://www.digitalmars.com/d/changelog.html
May 19 2005
parent "Walter" <newshound digitalmars.com> writes:
"Charlie" <charles jwavro.com> wrote in message
news:d6irpl$2gd7$1 digitaldaemon.com...
 Site looks great!
Thanks. I still want to replace the frames, though, with a more conventional t.o.c. on the left.
May 19 2005
prev sibling next sibling parent reply "Andrew Fedoniouk" <news terrainformatica.com> writes:
Finally! :)


"The condition is always satisfied, and Identifier is declared to be an 
alias of Type. "

What is the intention, your honour?

Andrew.



"Walter" <newshound digitalmars.com> wrote in message 
news:d6imvd$2c53$1 digitaldaemon.com...
 I'm not too sure about iftype. Let's see how it goes. Consider it
 'experimental' for now.

 http://www.digitalmars.com/d/changelog.html


 
May 19 2005
parent "Walter" <newshound digitalmars.com> writes:
"Andrew Fedoniouk" <news terrainformatica.com> wrote in message
news:d6jfrq$2uk1$1 digitaldaemon.com...
 Finally! :)


 "The condition is always satisfied, and Identifier is declared to be an
 alias of Type. "

 What is the intention, your honour?
It's just the degenerate case.
May 19 2005
prev sibling next sibling parent reply "Jarrett Billingsley" <kb3ctd2 yahoo.com> writes:
"Walter" <newshound digitalmars.com> wrote in message 
news:d6imvd$2c53$1 digitaldaemon.com...

Ooh, some nice new things to try out :)

Something I've wondered though - will the .size ever bee just ignored?  It 
seems kind of redundant to have an error just for .size when it could just 
say "no member .size for blah."  I suppose the error is just there for 
porting older D code, but will this error be removed for 1.0? 
May 19 2005
parent "Walter" <newshound digitalmars.com> writes:
"Jarrett Billingsley" <kb3ctd2 yahoo.com> wrote in message
news:d6jhcv$2vlb$1 digitaldaemon.com...
 "Walter" <newshound digitalmars.com> wrote in message
 news:d6imvd$2c53$1 digitaldaemon.com...

 Ooh, some nice new things to try out :)

 Something I've wondered though - will the .size ever bee just ignored?  It
 seems kind of redundant to have an error just for .size when it could just
 say "no member .size for blah."  I suppose the error is just there for
 porting older D code, but will this error be removed for 1.0?
Yes, it'll be removed. This is just a temporary thing to flush out any remaining older uses.
May 19 2005
prev sibling next sibling parent reply "Andrew Fedoniouk" <news terrainformatica.com> writes:
Seems like 'static if' and 'iftype' are the same statement.
Difference is just in type of condition expression.

Is it possible to combine them together somehow and to have
just one static if? (I personally prefer 'when' instead of 'static if' but 
anyway...

Currently in D, notation of 'if' statement is as:

IfStatement:
    if ( Expression ) Statement [else Statement]

So if we will add:
    static if ( Expression ) Statement [else Statement]
    static if typeof ( TypeParameter ) Statement [else Statement]

then it will not break existing grammar.

Other forms of latter two productions using 'when':

    when ( Expression ) Statement [else Statement]
    when typeof ( TypeParameter  ) Statement [else Statement]

I think that D should have clear "notational distance"
between runtime and compile time constructions.
static assert and static if are good at this point of view.
but standalone 'iftype' is too close to plain 'if'.

Just some thoughts aloud...

One more: probably this would be better:

static if cast ( TypeParameter ) Statement [else Statement]

?

Andrew.




"Walter" <newshound digitalmars.com> wrote in message 
news:d6imvd$2c53$1 digitaldaemon.com...
 I'm not too sure about iftype. Let's see how it goes. Consider it
 'experimental' for now.

 http://www.digitalmars.com/d/changelog.html


 
May 19 2005
next sibling parent reply "Unknown W. Brackets" <unknown simplemachines.org> writes:
I'd also prefer a merge of "static if" and "iftype".  I quite like 
static if, myself.  I guess I'd push:

static if (bar isimplicit int)
static if (bar as T)
static if (bar as T isimplicit int)

Or something.  Just seems : is a bit overused for various meanings.

Also, it'd be great to have a way to (statically) check for the 
existance of a symbol (specifically a function or class):

static if (&funcname)

Or something.  The above actually seems to work, but only if it does 
exist.  Otherwise:

staticif.d(9): undefined identifier test2

Which is, quite specifically, what I'd like to avoid.  This would allow 
me to release bar, which depends on foo, but have bar able to use foo 
1.0 or foo 2.0, depending on what it is compiled with.

-[Unknown]


 Seems like 'static if' and 'iftype' are the same statement.
 Difference is just in type of condition expression.
 
 Is it possible to combine them together somehow and to have
 just one static if? (I personally prefer 'when' instead of 'static if' but 
 anyway...
 
 Currently in D, notation of 'if' statement is as:
 
 IfStatement:
     if ( Expression ) Statement [else Statement]
 
 So if we will add:
     static if ( Expression ) Statement [else Statement]
     static if typeof ( TypeParameter ) Statement [else Statement]
 
 then it will not break existing grammar.
 
 Other forms of latter two productions using 'when':
 
     when ( Expression ) Statement [else Statement]
     when typeof ( TypeParameter  ) Statement [else Statement]
 
 I think that D should have clear "notational distance"
 between runtime and compile time constructions.
 static assert and static if are good at this point of view.
 but standalone 'iftype' is too close to plain 'if'.
 
 Just some thoughts aloud...
 
 One more: probably this would be better:
 
 static if cast ( TypeParameter ) Statement [else Statement]
 
 ?
 
 Andrew.
 
 
 
 
 "Walter" <newshound digitalmars.com> wrote in message 
 news:d6imvd$2c53$1 digitaldaemon.com...
 
I'm not too sure about iftype. Let's see how it goes. Consider it
'experimental' for now.

http://www.digitalmars.com/d/changelog.html
May 19 2005
parent reply "Unknown W. Brackets" <unknown simplemachines.org> writes:
Err, I guess I didn't meant static if (rather if), as iftype isn't 
necessarily static, I suppose.

-[Unknown]


 I'd also prefer a merge of "static if" and "iftype".  I quite like 
 static if, myself.  I guess I'd push:
 
 static if (bar isimplicit int)
 static if (bar as T)
 static if (bar as T isimplicit int)
 
 Or something.  Just seems : is a bit overused for various meanings.
May 19 2005
parent "Andrew Fedoniouk" <news terrainformatica.com> writes:
 Err, I guess I didn't meant static if (rather if), as iftype isn't 
 necessarily static, I suppose.
non-static iftype (non-compile time) has no practical meaning. At runtime type must be known so no uncertainty (if) here. So it is compile time creature. To have two versions of 'static if ' we should have designator boolean/typename expression. E.g. cast expression accepts only typename so it could be parsed reliably. What about this then: static if cast(bar : int) // satisfied because short can be // implicitly converted to int printf("satisfied\n"); else printf("not satisfied\n"); ? BTW: C++ uses < > brackets for typename expressions (many grammatic problems), but static if in C++ could be written as static if <bar:int> ... else ... .... "Unknown W. Brackets" <unknown simplemachines.org> wrote in message news:d6julq$8i7$1 digitaldaemon.com...
 Err, I guess I didn't meant static if (rather if), as iftype isn't 
 necessarily static, I suppose.

 -[Unknown]


 I'd also prefer a merge of "static if" and "iftype".  I quite like static 
 if, myself.  I guess I'd push:

 static if (bar isimplicit int)
 static if (bar as T)
 static if (bar as T isimplicit int)

 Or something.  Just seems : is a bit overused for various meanings. 
May 20 2005
prev sibling parent reply "Lionello Lunesu" <lio lunesu.removethis.com> writes:
Can't types already be checked with normal if's (using TypeInfo, .typeof)?
So why the iftype? or "static if typeof" or for that matter? Existing syntax 
should be used, if it can be  used.

Is it beacuse the result of .typeof is not known at compile time?

L. 
May 19 2005
parent reply "Andrew Fedoniouk" <news terrainformatica.com> writes:
 Can't types already be checked with normal if's (using TypeInfo, .typeof)?
In runtime (TypeInfo), yes. In compile time (typeof), no. TypeInfo is an object in runtime, typeof is a type name compile time.
 So why the iftype? or "static if typeof" or for that matter? Existing 
 syntax should be used, if it can be  used.
Agreed, but it is not the case.
 Is it beacuse the result of .typeof is not known at compile time?
result of typeof(expression) is known at compile time (it is a compile time function) but you cannot do almost anything useful with it. typeof() evaluates to type name which is (type name) not a string and not an object like TypeInfo. int a; typeof(1) a; are eqiuvalent in D. Andrew. "Lionello Lunesu" <lio lunesu.removethis.com> wrote in message news:d6jvgd$9gn$1 digitaldaemon.com...
 Can't types already be checked with normal if's (using TypeInfo, .typeof)?
 So why the iftype? or "static if typeof" or for that matter? Existing 
 syntax should be used, if it can be  used.

 Is it beacuse the result of .typeof is not known at compile time?

 L.
 
May 20 2005
parent reply "Walter" <newshound digitalmars.com> writes:
Also, iftype enables picking apart of a type using the type deduction
capability analogous to the template partial specialization rules.
May 20 2005
parent "Andrew Fedoniouk" <news terrainformatica.com> writes:
"Walter" <newshound digitalmars.com> wrote in message 
news:d6k3hi$e1u$1 digitaldaemon.com...
 Also, iftype enables picking apart of a type using the type deduction
 capability analogous to the template partial specialization rules.
Yep. And idea is good. But I think you aren't satisfied with the name too ... static if( ) is good. If we would have some distinctive notation for typenames and deductions then it will be possible to use something like : static if type(T:T[]) { ... } Ideas, anyone?
May 20 2005
prev sibling next sibling parent David Medlock <noone nowhere.com> writes:
Walter wrote:
 I'm not too sure about iftype. Let's see how it goes. Consider it
 'experimental' for now.
 
 http://www.digitalmars.com/d/changelog.html
 
 
 
D is Looking great, Walter! Very nice new features. Thanks! -DavidM
May 20 2005
prev sibling next sibling parent reply Stewart Gordon <smjg_1998 yahoo.com> writes:
Walter wrote:
 I'm not too sure about iftype. Let's see how it goes. Consider it
 'experimental' for now.
 
 http://www.digitalmars.com/d/changelog.html
At the moment I don't see how this iftype (bar T) alias T S; else alias long S; is any more useful than this alias bar S; Stewart. -- My e-mail is valid but not my primary mailbox. Please keep replies on the 'group where everyone may benefit.
May 20 2005
parent "Ben Hinkle" <bhinkle mathworks.com> writes:
"Stewart Gordon" <smjg_1998 yahoo.com> wrote in message 
news:d6kpfi$vtp$1 digitaldaemon.com...
 Walter wrote:
 I'm not too sure about iftype. Let's see how it goes. Consider it
 'experimental' for now.

 http://www.digitalmars.com/d/changelog.html
At the moment I don't see how this iftype (bar T) alias T S; else alias long S; is any more useful than this alias bar S;
agreed. the "else" clause is dead code if I understand correctly.
May 20 2005
prev sibling next sibling parent reply "Andrew Fedoniouk" <news terrainformatica.com> writes:
static if and especially iftype are in fact kind of anonymous template 
declaration and instantiation at one point.

Lets take a look on given example:

alias short bar;
int foo(bar x)
{
  iftype (bar : int) // satisfied because short can be
                         // implicitly converted to int
         printf("satisfied\n");
  else
          printf("not satisfied\n");
 }

It is in fact:

int foo(bar x)
{
   mixin Noname!(bar);
   template Noname(T) { printf("not satisfied\n"); }
   template Noname(T: int) { printf("satisfied\n"); }
}

Therefore if our intention is to move declaration and instantiation in one 
point we might
use 'anonymous templates' :

int foo(bar x)
{
    mixin template(bar: int)
   {
         printf("not satisfied\n");
    }
    mixin else
   {
         printf("satisfied\n");
    }
}

Huh?
May 20 2005
parent "Andrew Fedoniouk" <news terrainformatica.com> writes:
Pluses of the approach  ( 'mixin template' versus 'iftype' )
that I can write AND  type expressions too

mixin(bar: int, foo: double) // if  bar is int and foo is double
{
   printf("satisfied\n");
}
mixin else
{
    printf("not satisfied\n");
}
May 20 2005
prev sibling next sibling parent "Andrew Fedoniouk" <news terrainformatica.com> writes:
'Anonymous template declaration and instantiation'

to change 'static if' on

mixin if( BooleanExpression ) ... [ else ....  ]

to change 'iftype' on

mixin when ( Type : TypeSpecialization  )  [ else ... ]

formal definition of  Mixins in the specification is below.

This will give us:

mixin when(foo: int)
     printf("foo is like int") ;
else when (foo: double)
     printf("foo is like double") ;
else
     static assert( 0, " foo is neither int nor double" );

mixin if( n == 32 )
     int x;
else if( n == 16 )
     short x;
else
     box x;

---------------------------------------------------------

formal definition of  Mixins in the specification:

TemplateMixin:
  mixin TemplateIdentifier ;
  mixin TemplateIdentifier MixinIdentifier ;
  mixin TemplateIdentifier !( TemplateArgumentList ) ;
  mixin TemplateIdentifier !( TemplateArgumentList ) MixinIdentifier ;

(static if)
mixin if( CompileTimeBooleanExpression ) StatementOrBlockDecl
mixin if( CompileTimeBooleanExpression ) StatementOrBlockDecl
       [ else if( CompileTimeBooleanExpression ) StatementOrBlockDecl ]
         else StatementOrBlockDecl

(iftype)
mixin when( Type : TypeSpecialization ) StatementOrBlockDecl
mixin when( Type : TypeSpecialization ) StatementOrBlockDecl
       [ else when ( Type : TypeSpecialization ) StatementOrBlockDecl ]
       else StatementOrBlockDecl














"Walter" <newshound digitalmars.com> wrote in message 
news:d6imvd$2c53$1 digitaldaemon.com...
 I'm not too sure about iftype. Let's see how it goes. Consider it
 'experimental' for now.

 http://www.digitalmars.com/d/changelog.html


 
May 20 2005
prev sibling parent reply "Ben Hinkle" <bhinkle mathworks.com> writes:
"Walter" <newshound digitalmars.com> wrote in message 
news:d6imvd$2c53$1 digitaldaemon.com...
 I'm not too sure about iftype. Let's see how it goes. Consider it
 'experimental' for now.

 http://www.digitalmars.com/d/changelog.html
Are there some motivating examples for "static if" and iftype? The doc example illustrate the behavior but don't do anything useful so I'm not sure when to use these constructs vs template specialization.
May 20 2005
next sibling parent "Walter" <newshound digitalmars.com> writes:
"Ben Hinkle" <bhinkle mathworks.com> wrote in message
news:d6lf5g$1iv7$1 digitaldaemon.com...
 Are there some motivating examples for "static if" and iftype? The doc
 example illustrate the behavior but don't do anything useful so I'm not
sure
 when to use these constructs vs template specialization.
www.digitalmars.com/d/cpptod.html, look at the last example
May 20 2005
prev sibling parent reply "Andrew Fedoniouk" <news terrainformatica.com> writes:
imagine that somewhere I have a constant WINVER and
enum winver{
    WIN95,
    WIN98,
    WINME,
    WIN2K,
    WINXP,
    WIN2K3,
    WINXP64
}

so I can do something like this (statically)

static if( WINVER <=  WINME) // mixin if
    .... 16bit GDI ops...
else  if ( WINVER >=  WINXP64)
    .... 64bit GDI ops...
else
    .... 32bit GDI ops...

In fact if there are just few choices in enum winver I will probably do this
by using mixins or probably version.

mixin when (iftype) is a bit more interesting as it allows you to do
instantiation more deterministic and flexible:

mixin when( coordinate : long, color : long  ) ....
  else when( coordinate : int, color : long  ) ....
  else when( coordinate : long  ) ....
  else when( coordinate : int  ) ....
  else static assert(0, "unsuppported target configuration");

-----------------------------------------------
But of course we can live without this ...
It is just a matter of comfort I would say.

Andrew.



"Ben Hinkle" <bhinkle mathworks.com> wrote in message 
news:d6lf5g$1iv7$1 digitaldaemon.com...
 "Walter" <newshound digitalmars.com> wrote in message 
 news:d6imvd$2c53$1 digitaldaemon.com...
 I'm not too sure about iftype. Let's see how it goes. Consider it
 'experimental' for now.

 http://www.digitalmars.com/d/changelog.html
Are there some motivating examples for "static if" and iftype? The doc example illustrate the behavior but don't do anything useful so I'm not sure when to use these constructs vs template specialization.
May 20 2005
next sibling parent John Reimer <brk_6502 yahoo.com> writes:
Andrew Fedoniouk wrote:
 imagine that somewhere I have a constant WINVER and
 enum winver{
     WIN95,
     WIN98,
     WINME,
     WIN2K,
     WINXP,
     WIN2K3,
     WINXP64
 }
 
Hey... that's not hard to imagine! It looks very familiar. ;-) -JJR
May 20 2005
prev sibling parent "Ben Hinkle" <ben.hinkle gmail.com> writes:
"Andrew Fedoniouk" <news terrainformatica.com> wrote in message 
news:d6lj2t$1lqg$1 digitaldaemon.com...
 imagine that somewhere I have a constant WINVER and
 enum winver{
    WIN95,
    WIN98,
    WINME,
    WIN2K,
    WINXP,
    WIN2K3,
    WINXP64
 }

 so I can do something like this (statically)

 static if( WINVER <=  WINME) // mixin if
    .... 16bit GDI ops...
 else  if ( WINVER >=  WINXP64)
    .... 64bit GDI ops...
 else
    .... 32bit GDI ops...

 In fact if there are just few choices in enum winver I will probably do 
 this
 by using mixins or probably version.
makes sense.
 mixin when (iftype) is a bit more interesting as it allows you to do
 instantiation more deterministic and flexible:

 mixin when( coordinate : long, color : long  ) ....
  else when( coordinate : int, color : long  ) ....
  else when( coordinate : long  ) ....
  else when( coordinate : int  ) ....
  else static assert(0, "unsuppported target configuration");
Iftype is actually pretty fun. I've started using iftype in MinTL to support custom memory allocators. For example a couple of simple used in Deque are struct Deque(Value, Alloc = GCAllocator) { void clear() { iftype (Alloc : GCAllocator) { } else { foreach (Block p; data) { Alloc.freeData(p); } Alloc.free(data.ptr); } *this = Deque.init; } Block newBlock() { iftype (Alloc : GCAllocator) { return new Value[BlockSize]; } else { Value* p = cast(Value*)Alloc.mallocData(BlockSize * Value.sizeof); Value[] q = p[0..BlockSize]; q[] = Value.init; return p; } ... } So this way a user can declare Deque!(int) x; to get a standard entirely-GC allocator or use a predefined allocator like Deque!(int,Malloc) y; that is aliased to use std.c.stdlib.malloc and friends. Another one of the predefined allocators is GCMalloc that allocates data from the GC since it may contain root and non-data from malloc. Of course using malloc one has to be careful to not leak but that's expected. Anyhow, maybe I'll also cook up an allocator to work around the +1 issue that makes GC allocations so inefficient. I haven't tried that yet.
 -----------------------------------------------
 But of course we can live without this ...
 It is just a matter of comfort I would say.

 Andrew.



 "Ben Hinkle" <bhinkle mathworks.com> wrote in message 
 news:d6lf5g$1iv7$1 digitaldaemon.com...
 "Walter" <newshound digitalmars.com> wrote in message 
 news:d6imvd$2c53$1 digitaldaemon.com...
 I'm not too sure about iftype. Let's see how it goes. Consider it
 'experimental' for now.

 http://www.digitalmars.com/d/changelog.html
Are there some motivating examples for "static if" and iftype? The doc example illustrate the behavior but don't do anything useful so I'm not sure when to use these constructs vs template specialization.
May 21 2005