Existential types, object-orientation.
rinus plasmeijer
rinus@cs.kun.nl
Thu, 6 Nov 1997 10:28:55 +0200
Hi Nick,
At 16:48 -0800 05-11-1997, Nick Kallen wrote:
>Existential types are a spiffy feature for psuedo-object orientation as is
>clearly seen in the Clean book in the OO Drawing program chapter. I have a
>few questions related to object-orientation as seen in some of the more
>modern mixed languages like Java and Oberon:
> Can one can use inheritence or class polymorphism with Existential type=
s
>in Clean? If not, are these concepts even compatible?
I don't understand this question. Can you be more precise?
> Could dynamic types be implemented in a functional language like clean?
>Exactly how would it work? Could one simulate prototypes in a functional
>language?
Dynamic types are currently being implemented in the new Clean compiler.
Any static type T can be converted to a dynamic type. Via pattern matching=
one can inspect a dynamic type and unify with other dynamic types.
>My only real use of existential types is seeing the Clean book (I'm pretty
>new to functional programming). It is probable that their potential uses fa=
r
>exceed the limited scope of usage in the book. If anyone can provide any
>interesting problems or data structures implemented with existential types
>(in a manner distinct from that of the Clean book), I'd be appreciative.
You can have a look in the Object I/O library which makes use of existential=
types.
>Furthermore, if anyone can provide any critical information, relating
>existential types to object-orientation, their limitations, etc.--I'd be
>appreciative.
One of the important limitations of existential typed structures is that the=
concrete type cannot be inspected from "outside". Dynamic don't have this=
restriction. Their type can always be inspected but the costs are that the=
types have to be maintained at run-time, while existential types are static=
types.
Greetings,
Rinus