What's wrong with D's templates?
Rainer Deyke
rainerd at eldwood.com
Mon Dec 21 02:04:18 PST 2009
yigal chripun wrote:
> 2) structural typing (similllar to Go?)
> tp!(Foo) // OK
> tp!(Bar) // also OK
>
> 3) C++ style templates where the compatibility check is against the
> *body* of the template.
>
> If you think of templates as functions the compiler executes, the
> difference between the last two options is that option 2 is staticly
> typed vs. option 3 which is dynamicaly typed. We all use D because we
> like static typing and there's no reasone to not extend this to
> compile-time as well.
I prefer to think of option 2 as explicitly typed while option 3 uses
type inference. Type inference is a good thing.
--
Rainer Deyke - rainerd at eldwood.com
More information about the Digitalmars-d
mailing list