On Mon, 27 Sep 1999, Alex Ferguson wrote:
> Kevin Atkinson, replying to me:
>
> > > If I understand you correctly, then the best way of doing this would be
> > > with existentially (boundedly) quantified data types, currently a
> > > non-standard extention present in hbc (and I think, ghc, these days, not
> > > sure if it's with the same generality.)
> >
> > existentially (boundedly) quantified data types can not cast up.
>
> 'Cast up' to what? If you can't write a class context that descibes
> the relatedness of everything you want to put in a heterogenous collection,
> then I'm inclined to doubt if it isn't more heterogenous than is
> sensible.
You have a collection of Shapes. Some of these shapes are circles,
however, others are rectangle. Occasionally you will need to extract
these specific shapes form the collection of generic shapes as there is no
way to find the length and width of a generic shape, only its area and
circumference. So I need to cast the objects in shapes that are *really*
rectangles back up to rectangles.
1) test for the true type of the object
2) cast it back up to its true type
> > In order to do that you would ALSO need to use the dramatic typing
> > extensions found in the GHC/Hugs library.
>
> I don't see how this relates to anything other than heterogenous collections;
> perhaps an example?
A collection of objects with existential types very often is a
heterogeneous collections.
> > The point that class hierarchy isn't precisely _type_ hierarchy is
> > exactly the point I am trying to get gate Haskell needs to also be able to
> > support a class hierarchy if it is to really support OO style programming.
>
> I'm aware that Haskell doesn't precisely ape that sorts of 'OOP
> style' that the likes of C++ admits What I've yet to see is any
> argument that this is anything other than the wisest possible decision...
And by this you mean...
---
Kevin Atkinson
[EMAIL PROTECTED]
http://metalab.unc.edu/kevina/