Revisiting Decimal (generic algorithms)
brendan at mozilla.com
Fri Jan 30 22:32:36 PST 2009
On Jan 30, 2009, at 6:28 PM, Brendan Eich wrote:
> According to http://en.wikipedia.org/wiki/Polymorphism_(computer_science)
> (hey, it's referenced):
> There are two fundamentally different kinds of polymorphism,
> originally informally described by Christopher Strachey in 1967. If
> the range of actual types that can be used is finite and the
> combinations must be specified individually prior to use, it is
> called Ad-hoc polymorphism. If all code is written without mention
> of any specific type and thus can be used transparently with any
> number of new types, it is called parametric polymorphism. John C.
> Reynolds (and later Jean-Yves Girard) formally developed this notion
> of polymorphism as an extension to the lambda calculus (called the
> polymorphic lambda calculus, or System F).
> So multimethods use parametric polymorphism.
Correction: multimethods are ad-hoc too, since you have write a
particular type combination. For dyadic operators, the multiple-
argument dispatch differs from single (left, receiver) dispatch, but
the type combinations are still finite and specified.
Not sure this matters. The real argument is about single vs. multiple
> Lars's point about future-proofing, when he wrote "ad-hoc
> overloading", seems to me to be about adding extensible dyadic
> operators via double-dispatch now, then adding multiple dispatch in
> some form later and being prevented by compatibility considerations
> from changing operators. Best to ask him directly, though -- I'll do
Lars meant exactly that -- in any conversation tending toward a future
version of the language where multimethods or something that addresses
the "bugs" (or features from the other point of view) of single-
dispatch operators might come along, standardizing single dispatch and
requiring double(-single)-dispatch from left to right, with
"reverse_add" and so on, would be future-hostile.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Es-discuss