[Proposal]

Sean Fritz Sean_member at pathlink.com
Tue Jun 20 14:34:11 PDT 2006


In article <e7583j$2drm$1 at digitaldaemon.com>, Daniel Keep says...
>I suppose the one advantage that .NET has over Java *and* C++/D is that
>its templates are compiled without being expanded first.  This means
>that arbitrary libraries can come along and instantiate the templates,
>even without the source code.  AFAIK, Java does what C++ and D do, which
>is to expand all the templates on compilation.

This is incorrect.  It is even more complicated than that.  Generics are
compiled <i>away</i> at compile time and the only thing left at runtime is the
erasure (which is the least specific class that represents the type).

Generics have very little to do with templates, and to treat them as such is
simply going to lead to frustration.  You are correct in saying they are mostly
for compile time casting, because that's exactly what they do.  A different goal
than C++ templates.





More information about the Digitalmars-d mailing list