Re: Generics vs. Message passing: object namespaces
[email protected] Fri, 23 Feb 2007 22:05:14 -0500 (EST)
| Newsgroups | gmane.comp.lang.lightweight |
|---|---|
| Message-ID | <[email protected]> |
>>> (draw gun args)
>>
>> This is exactly what I've been wondering about. It's essentially a
>> hybrid of object-dispatch and GF. I have a feeling though, that the
>> CLOS proponents will object to the special status afforded to the
>> first arg.
>
> In CLOS, the first argument has more precedence in determining method
> specificity than later arguments, so in this sense, CLOS already
> gives the first argument a special status...
I think what was meant was special status to the first arg *after the
function*, that is, the second arg from a LISP perspective. This is
very different from what CLOS does. It is semantically equivalent to
object dispatch.
> I find it counter-intuitive to use the same function for vastly
> different purposes, no matter whether it is a generic one (in the
> CLOS sense) or not.
Absolutely. But in object dispatch obj1.foo and obj2.foo are not
expected to do the same thing since the two foo's clearly are from two
different namespaces, if the objects are unrelated, and thus are
conceptually different words, whereas (foo obj1) and (foo obj2) are
necessarily from the same namespace, without additional
disambiguation, possibly non-local.
> Compared to the expresive power that generic functions buy me, I
> remain very unexcited about the naming issue.
Generic functions are not the same thing as generic dispatch. Nobody
is arguing that anyone give up generic functions.