Re: Generics vs. Message passing: object namespaces

Douglas Philips <[email protected]> Fri, 23 Feb 2007 20:52:20 -0500
Newsgroups gmane.comp.lang.lightweight
Message-ID <[email protected]>
On 2007 Feb 23, at 8:16 PM, Pascal Costanza indited:
>> Anyone see any problems with this?
>
> 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.

Hear, hear!

The "canonical" example, say of "draw" in a graphics system unifies a  
concept across multiple "drawable" objects. That one can pun and also  
refer to unholstering or to phlebotomize with the same term is to  
equivocate over the name, perhaps even disingenuously.


>> T.
>>
>> p.s. I think Mike hit the nail on the head - it's about pragmatism  
>> not absolutes. As you said yourself recently Pascal, language  
>> design is all about convenience, and shorter, more readable names  
>> are more convenient, even if there are occasions when you have to  
>> fall back to a more verbose style.
>
> Compared to the expresive power that generic functions buy me, I  
> remain very unexcited about the naming issue.

Agreed. Naming is hard, and all the good and short names are taken. :-)

Further, to say that object_o.draw( a, b, c ) somehow magically  
disambiguates "draw" is misleading. The types and number of accepted  
parameters to 'draw' depend on knowing the type of "object_o"... and  
while one may not know the exact type of 'object_o', one does need to  
know what species or kingdom it belongs to in order to "ask it to  
'draw' itself".

I agree that shorter/smaller code is easier to understand than long  
wordy code. There are much better ways to get shorter/smaller code  
that is easier to read code than by using non-transparent non-local  
type information to shorten one word. But if you don't have the  
experience with those other methods, you might be stuck in the Blub  
paradox(1), arguing against something you don't fully understand.  
Well, I've only been 3/4ths following this, but Pascal's reaction to  
the naming issue struct a resonant chord...

(1) - http://www.paulgraham.com/avg.html

--Doug