[Haskell-cafe] How to present the commonness of some objects?

Stuart Cook scook0 at gmail.com
Fri Jul 3 05:15:53 EDT 2009

2009/7/3 Luke Palmer <lrpalmer at gmail.com>:
> Keep in mind that with this solution *and* with the
> ExistentialQuantification solution, there is no possibility of downcasting.
>  I.e. if you were planning on making a GraphicalWidget subclass, and them
> somewhere seeing if a a Widget is actually a GraphicalWidget, you will be
> disappointed.  The solution in this case is to redesign your software not to
> need downcasting.  This is the point at which you are forced to move away
> from OO thinking.

Heck, as far as I'm aware most OO communities frown on downcasting
too. The "OO approach" is to call a virtual method and let the object
decide to do, which (with enough hand-waving) is basically what you
end up doing here anyway.


More information about the Haskell-Cafe mailing list