HLL is not against LLL

Patrick Premont premont@IRO.UMontreal.CA
Wed, 19 Jul 1995 15:06:11 -0400 (EDT)


> 
> 
> hi, you wrote:
> > [Dylan] Function calls have no distinguised receiver
> > and I think that's good (it uses generic functions).
> 
> i repeat: that's not good.  lookup from the object is simpler, more
> efficient, more intuitive (most of the time) and better structured than
> lookup from the verb (the function).  it still allows further
> dispatch on the args' types.
> 

I said that because I knew someone disagreed and it would give a
chance to debate it (and because it's what I think).

Having a generic function reifies (makes into an object) the dispatch
technique. This is good for reflexion because you can then observe,
modify and create new dispatch techniques.
This benefit arrises even if you want to dispatch on only one arguement.
You can very well create a generic function that only dispatches on the
first arguement, although I've never seen it in a language. 

Also dispatching on all the arguements is more general and can be
automatically reduced to the single arguement dispatch when the set of
methods differ in only one of the arguements (which doesn't have to be
the first one).
So I disagree that single argument dispatch is more efficient. For the
same set of methods both techniques are just as efficient and for
set of methods differing in the types of more than one arguement, the
generic function can do things which end up being faster than chained
single arguement dispatches. And chaining single arguement dispatches
is a mess. It introduces a lot of noise in the source, many versions
of the function each dispatching on one of the argument.

Finally, modularity and reuse suggest solving the problem once and
making it available in the form of a generic function instead of
dealing with multiple dipatch every time you need it.

Patrick