[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how is polymorphism used?

On 2003-03-13T11:40:20-0500, Russ Ross wrote:
> 2. The code is written polymorphically, but is really only used in a
> single way.  This is basically a special case of #1, but an
> important one.  How often do we work to be generic but not realize
> any benefits?

I want to point out that, at least in a statically typed system, there
are benefits to polymorphic/generic code beyond being able to *invoke*
the code at different types.  I have more than once found bugs in my
code because the type inferred by the compiler for a function is more
or less general than what I expected or intended.  Too bad explicit
type signatures can only catch the case when the inferred type is not
as general as the intended type...

Edit this signature at http://www.digitas.harvard.edu/cgi-bin/ken/sig
Sign the emergency petition to the U.N. Security Council:

Attachment: pgp19007.pgp
Description: PGP signature