[TriLUG] C# and .NET

Tanner Lovelace lovelace at wayfarer.org
Mon Jul 1 16:29:53 EDT 2002


On Mon, 2002-07-01 at 16:22, Andrew C. Oliver wrote:

> Understand Java Generics:  They aren't as powerful as C++ templates, in 
> fact the Java Generics spec in my
> opinion is a waste of time.  Its "compile-time" generics, meaning a 
> bunch of those MyClass$1.class files for
> everything you genericise.  Secondly, there will NOT be support for 
> primitive types.

Andrew, from your response it doesn't look like you understand
C++ templates.  C++ templates happen strictly at compile time
too.  There is no form of "run-time" templates anywhere in
C++.  What is it about "compile-time" generics you have a problem
with?

About support for "primitive types".  Why will it not
support them?  If not, then *that* does severely limit them.
But, then again, one of my biggest grips with java is it's
lack of a typedef operator, so oh well...

Also, does it support templates of templates?  Partial specialization?
While that is a part of C++ that is a bit difficult to understand,
it also allows templates to do very powerful stuff.
Take a look at the Blitz library (http://www.blitz.org, iirc).
They're using templates to get assembly like linear
algebra performance using C++.
 
> So generics will be *strictly* syntax candy.

Syntax yes, but more than candy.  Generics (such as templates)
allow you to spot problems at compile time rather than run
time.  This allows better debugging (since once you get it
running, you can then disregard a whole class of possible
errors) and faster development.  Candy, it most assuredly
is not.

Tanner
-- 
Tanner Lovelace | lovelace at wayfarer.org | http://wtl.wayfarer.org/
--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--
GPG Fingerprint = A66C 8660 924F 5F8C 71DA  BDD0 CE09 4F8E DE76 39D4
GPG Key can be found at http://wtl.wayfarer.org/lovelace.gpg.asc
--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--
   He who receives an idea from me, receives instruction himself 
   without lessening mine; as he who lights his taper at mine, 
   receives light without darkening me.  --  Thomas Jefferson




More information about the TriLUG mailing list