This is the mail archive of the guile@cygnus.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: records


Jost Boekemeier wrote:
> Chris Bitmead <chris@tech.com.au> writes:
> 
> > In C++/Eiffel terminology, scheme `display' is, or at least appears to
> > be polymorphic.
> 
> No. In Bertrand Meyer's terminology `display´ is generic.  See page 1168
> the generic SWAP procedure.
> The example is written in ADA but even standard C has genericity:
> 
>   #define SWAP(x, y) {x^=y;y^=x;x^=y} /* constrained genericity

Swap uses the same code for all data types (x=y,y=x etc). This is
generics in Eiffel. However display is unlikely to have the same code
for all types - converting an int to a string, float to string for
printing, requires entirely different logic and can't be achieved by
Eiffel generics. It is generics in the CLOS sense though.

> > From the OO FAQ...
> > "Parametric polymorphism,... Ad-hoc polymorphism"
> 
> I don't know which terminology the author of the "OO FAQ" uses but
> when we apply the standard OO terminology then "parametric
> polymorphism" is simply nonsense.

I'm not sure that there is "standard OO terminology". However there's
clearly two uses of generic. Generic in Eiffel is _one_ class that can
be made to work  with different types of parameters. (Scheme can do this
anyway because it is untyped). Generics in CLOS is _different_ functions
(but presumably semantically the same), different versions of which are
called for different parameters.
 
> Bertrand Meyer describes in his book "Object Oriented Software
> Construction" on pages 1168ff what constrained genericity,
> unconstrained genericity and inheritance is and how genericity 
> could be emulated by using inheritance (page 1176ff).

Well, Bertrand is pushing his cart which is static typing and Eiffel in
particular. Actually I'm not sure anybody except Eiffel people use the
work generic in quite the way they do.

-- 
Chris Bitmead
mailto:chris@tech.com.au

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]