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:
> 
> Maciej Stachowiak <mstachow@alum.mit.edu> writes:
> 
> > The way I have always seen it used in papers on type
> > theory is that a polymorphic type is one that has one or more other types
> > as a parameter.[...]
> > sometype[T] = int, T -> (list T)
> 
> When we talk about the OO paradigm I think we should apply OO terminology.

I think when talking about type systems we should apply terminology
from type theory and not redefine the terms when the context is "Object
Oriented".

> Following Booch, Rumbaugh, Meyer, Stourstrup and others, the above example
> is a "template".  A template can be used to create new types. It consists
> of a _generic_ type with one or more _concrete_ types as the parameter.

In type theory this is called a polymorphic type, or, if the polymorphism
is explicit in lanaguage syntax, as with templates, a "parametric type". 
"template" is the term used for a particular variety of polymorphism
in some languages. Others, such as Ada, call them "generics". Please
let's not use concrete-bound terminology to discuss things on a
theoretical level.
 
> According to Rumbaugh, Booch, Wirth, Meyer and others an _operation_
> is polymorph if there exists two or more _methods_ implementing the
> operation. For example the operation "vehicle move" will be
> implemented differendly for a car and a bike.  Although a car is a
> vecicle and a bicicle is a vehicle and thus both use the same
> operation, the methods are differend.

If you believe a method is an entity that, at least logically, has
an independent existence from its class, then it is polymorphic in
the sense I stated: it has the type of the class it belongs to as
an implicit parameter. Note that a function that has polymorphic
type will not necessarily use code that is the same, with textual
subsitution of the type parameters, regardless of the type of argument
it is applied to. Even C++ templates have the concept of
"specialization".

In other words, a plymorphic operation is one that has a polymorphic
type. How the polymophism is implemented, whether by template-like or
class-method-like or CLOS-like multiple dispatch means, is not relevant
from a type theory point of view.

 - Maciej

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