Generics

Andrew Berg andrew_c_berg at yahoo.com
Sun Sep 28 17:02:06 UTC 2003


...taking this off-list since it is so off-topic...

On Sun, 28 Sep 2003 09:43:41 +0100, Phil Hudson <phil.hudson at iname.com> 
wrote:

>
> BTW, "generics" is a (badly named, IMO) synonym of the other terms. It's
> the term usually used in discussions of adding type-safe collections to
> Java. It doesn't mean what you (and I, initially) intuitively grasped. I
> don't know how it originated.
>
>

A quick (off-topic) history lesson.  As I understand it, generics were 
first implemented in ADA, which was a strongly, statically typed language.  
In ADA, since there was no type coersion, collections were implemented as 
generic packages:  One in which one or more of the types were undeclared at 
the time of package compilation.  Then the package could be instantiated 
into a concrete package, much like how templates work in C++.

I think that the term predates C++'s "template" by about 5 years.  One of 
the reasons that ADA generics worked better than C++'s template types is 
that they were constrained to packages and had tighter integration into the 
language.  Templates, in comparison, feel much more like a slightly 
improved macro preprocessor.

-andrew

-- 
andrew_c_berg at yahoo.com



More information about the Squeak-dev mailing list