Re: Generics vs. Message passing: object namespaces
Douglas Philips <[email protected]> Fri, 23 Feb 2007 22:24:31 -0500
| Newsgroups | gmane.comp.lang.lightweight |
|---|---|
| Message-ID | <[email protected]> |
On 2007 Feb 23, at 10:05 PM, [email protected] wrote: >> 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. obj1.foo and obj2.foo are not disambiguated by obj1 or obj2, they are disambiguated by the types of obj1 and obj2. Information which is _not_ stated at the point, but yet which is required so that the programmer will pass the correct number and type of parameters to obj1.foo( ) and obj2.foo( ). If you object to (image:draw obj1 ...) vs. (holster:draw obj2 ...) because having to indicate the 'source' of draw you wish to invoke is wordier, I agree with Pascal on that. Yawn. I'd rather see the intent made clear in ambiguous cases (and hence this is applicable to Pascal's Java MI example), for I have much more powerful ways to condense my code than saving one word by extracting the type of obj1/ obj2. --Doug