Re: Generics vs. Message passing: object namespaces

Pascal Costanza <[email protected]> Fri, 23 Feb 2007 11:15:07 +0100
Newsgroups gmane.comp.lang.lightweight
Message-ID <[email protected]>
On 23 Feb 2007, at 11:04, Tom Locke wrote:

>> (In a Scheme-style language, even the generic functions are  
>> anonymous and are simply bound to variables, so in such languages  
>> this all boils down to having a good modularization mechanism for  
>> plain variables.)
>
> The point about message-dispatch OO, is that the type of the  
> receiver (or first argument if you prefer) is used to locate the  
> namespace. A modularization mechanism for plain variables wouldn't  
> get into what the variable happened to be bound to - the call takes  
> place after the variable has been looked up, as an entirely  
> separate operation.

That doesn't work well as soon as you incorporate multiple  
inheritance (or Smalltalk/Fortress-style traits, for example). Even  
without implementation inheritance, pure multiple inheritance of  
signatures (like with Java's interfaces) already poses a problem here.

Sooner or later, the libraries of some language will grow bigger, and  
then sooner or later, you need objects that adhere to incompatible  
interfaces (messages that happen to have the same name but are used  
for different purposes). You can then either choose to distribute the  
functionality across several objects, and get object identity  
problems along the way, or you can choose to incorporate proper  
namespace management.


Pascal

-- 
Pascal Costanza, mailto:[email protected], http://p-cos.net
Vrije Universiteit Brussel, Programming Technology Lab
Pleinlaan 2, B-1050 Brussel, Belgium