Andreas Rossberg: Andreas R. wrote:
"dynamic binding" is just the OOO way of saying "calling a first-class function").
Let me presume that dynamic binding was meant here in the sense of late binding, in the sense of subtyping polymorphism. At least, the given shapes example strongly suggested that. If so, I can't fully parse your reply in this context. Please elaborate. (First-class function seems to refer to currying or what?) (Did you miss a "polymorphic" before function? That would explain it. But then again, note, *first-class polymorphism* comes at the price of extra types just as the ugly ex. polymorphism trick. (This is of course just the same trick, indeed.) As we argue in Section 5.6 of the OOHaskell draft, current version, this does really not scale!) Andreas R. wrote:
In typical functional programming style, you need the general thing only rarely.
My impression is that the reason for not wanting (some do want however) true dynamic binding in Haskell relates more to the fact that we willingly make closed world assumptions about the cases to dispatch one. Where the C++ programmer defines classes, we are often just fine to define *one* datatype with n constructors (corresponding to n classes). In such a case, we have an easy time (except when we want case n+1 without recompilation). Using this "idea", late binding degenerates to pattern matching, which is the value-level variation on VMT dispatch. (And for the rare cases, where we want to become polymorphic with an open world, we seem to be willing to sacrifice type inference and we engage into existential polymorphism / first-class polymorphism.) And then of course with normal Haskell type classes we can nicely simulate *interface* polymorphism (again modulo the lack of type inference for subtyping polymorphism). So pre-OOHaskell doesn't miss a lot ;-) Ralf
Ralf Lammel wrote:
"dynamic binding" is just the OOO way of saying "calling a first-class function").
Let me presume that dynamic binding was meant here in the sense of late binding
Yes.
in the sense of subtyping polymorphism.
No, as far as I read it, "dynamic" or "late binding" is orthogonal to subtyping, or typing in general. It is just that most typed OO languages lump these concepts together. For me, "dynamic" or "late" binding just means calling (or more generally, accessing) something that is not determined statically. That is precisely what first-class functions provide. Objects just turn more complex uses of this idiom into a language concept. Operationally, objects are equivalent to records of first-class functions. They usually come with more flexible typing and more efficient implementation, though.
(First-class function seems to refer to currying or what?)
No, constructing closures, and passing them around as values (currying is merely a particularly convenient special case of this).
(Did you miss a "polymorphic" before function? That would explain it.
I don't understand what you mean. Polymorphism is about typing. Late binding is not dependent on typing (there are untyped OO languages, for example). Cheers, - Andreas [Followups to Haskell Cafe] -- Andreas Rossberg, rossberg@ps.uni-sb.de Let's get rid of those possible thingies! -- TB
participants (2)
-
Andreas Rossberg -
Ralf Lammel