Re: Generics vs. Message passing: object namespaces

[email protected] Fri, 23 Feb 2007 16:27:03 -0800 (PST)
Newsgroups gmane.comp.lang.lightweight
Message-ID <[email protected]>
> On 2/23/07, Matt Knox <[email protected]> wrote:
>> It shouldn't be hard to make the package system create a dispatch
>> function
>> when it detected function name collisions. Then, as long as the argument
>> types encode enough information to decide which method to call, you're
>> fine.
>
> Right, this is pretty much what happens when you use defmethod and
> load different source files. So we're really talking about module
> system deficiencies here, I suppose.

    No.  Object1.foo and object2.foo select two entirely unentangled
entities with object dispatch, if object1 and object2 are unrelated. 
Smashing *unrelated* methods together that happen to have the same
name into a single entity is deeply wrong, conceptually, and bound to
cause real problems in the real world as well.  That CLOS does not do
that is not a shortcoming but a feature.

    Generic dispatch forces a collision to occur and *create* a
relationship where the programmer(s) intended none.  The user must
then explicitly disentangle this unwanted fender-bender.  This may be
a sign that generic dispatch is simply inadequate in the fullness of
time and design space.  A module system can alleviate this to a
degree, but perhaps object dispatch really is better.  Object dispatch
is not antithetical to functional programming or generic functions, so
I don't think one can necessarily make the argument that generic
dispatch is necessary in a LISPy OO system, as has been suggested.