This is the mail archive of the
guile@sourceware.cygnus.com
mailing list for the Guile project.
Re: Trouble understanding define (!)
Eric Moore <moore@chem.cmu.edu> writes:
> Well, I would say that merging two generic functions means creating a
> generic function with a set of methods that is the union of the methods
> of the two generics that are being merged.
Is it the union of methods or the union of all locations (of these
methods)? I think it's the union of all locations.
> It is useful in the case where you want to use the same name in your
> code (like 'size', 'length', or the now-canonical example 'draw') to
> access the methods in both of the GF's that you're merging, rather
> than the more cumbersome graphic-draw vs deck-draw.
Yes. Names conflict, locations don't.
> Can in every case two GF's be merged? no, of course not, it's only
> posible where the GF's have the same arity
Excuse me but what is the arity of a GF?
> Yes, the module system binds names to locations. So? How does this
> solve the problem that some of us would like to bind the name 'draw'
> (or 'size') to the union of the locations of the tuples [cards draw
> deck] and [graphics draw triangle]?
[cards draw deck] and [graphics draw triangle] are different
because they have
a) a different specializer (triangle vs. deck). GOOPS already
handles this case.
b) belong to two different modules (cards vs. graphics). Goops can
handle this case if you introduce the module as some kind of
"pseudo specializer" (I referred to it as a "module back-pointer"
in my other message).
Now what about [cards draw line] and [graphics draw line]?
They have different locations because they belong to two
different modules. The module system only cares about names.
It detects two different locations and if you rename one of
them to a new name (and/or re-order the import-list), you can
access both.
Jost