Re: Generics vs. Message passing: object namespaces

"Joe Marshall" <[email protected]>
Newsgroups gmane.comp.lang.lightweight
Message-ID <[email protected]>
On 2/22/07, Tom Locke <[email protected]> wrote:
> I may well have missed it, but in all this talk of generic-function
> based OO vs. message-passing OO, what about the issue of namespaces
> scoped to objects.
>
> e.g.
>
>     buffer.append(x) vs. append_to_buffer(buffer, x)
>
> I believe I am correct in stating that the generic function style
> requires the latter? Sharing a single generic function "append" among
> the very wide range of objects that might provide a definition isn't
> workable.

Why not?

The usual implementation of this sort of thing is a table of methods.  Along one
dimension we select by the type of the object and along the other we select by
the method name.  In a Simula-style implementation, the table is
usually sliced up
according to type, but in a CLOS-style implementation it is sliced up
by message.

-- 
~jrm
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.