This is the mail archive of the
guile@sourceware.cygnus.com
mailing list for the Guile project.
Re: Trouble understanding define (!)
Mikael Djurfeldt writes:
[ generic function extension discussion ]
The effect is just what we want: instead of shadowing another GF with
the same name, there is a new GF created which contain the union of
methods.
Surely this makes it impossible for A:grumble's method set to be
modified, and that means that A cannot provide a MOP to its users.
(Which is very bad news if A happens to be (oop goops)!)
I think that <extended-generic> is on the right track, but it also
needs to be possible to add a method to an imported generic function
without causing the name to be rebound to an <extended-generic>.
So how about:
- define-generic NAME
Makes NAME a <generic> with no methods. Loses any existing value
for NAME.
- define-generic NAME #:importing GF
Makes NAME an <extended-generic> that uses the existing GF. Loses
any existing value for NAME.
- define-extended-generic NAME
-> define-generic NAME #:importing NAME
- define-method GF SPEC BODY
Raise error if (not (is-a? GF <generic>)). (GF arg having been
evaluated.) Otherwise create specified method and use add-method!
to add it to GF.
Regards,
Neil