On Mon, Jan 27, 2003 at 12:25:52PM +0200, Lauri Alanko wrote:
> On Mon, Jan 27, 2003 at 08:37:06PM +1100, Fergus Henderson wrote:
> > I agree.  The above characterization is highly misleading.  It would be
> > more accurate and informative to say that both Haskell and OO languages
> > dispatch on the dynamic type of a value.
> 
> What is the "dynamic type of a value" in Haskell, apart from existentials
> and Dynamic? Ordinary type class dispatch is all done based on the types of
> variables, not their values. All the dispatching could even be done at
> compile time by specializing everything...

I don't think this is true, even without existential types.
Polymorphic recursion may involve building dictionaries at run time,
which certainly approaches dynamic dispatch.

(Polymorphic recursion is one of Chris Okasaki's favorite tricks.  It
involves definitions like

data Tree a = Leaf a | Node (Tree [a]) (Tree [a])

in which the variable 'a' is used recursively at a different type.)

Best,
        Dylan Thurston

Attachment: msg12142/pgp00000.pgp
Description: PGP signature

Reply via email to