This is the mail archive of the guile@sourceware.cygnus.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Trouble understanding define (!)


Marius Vollmer <mvo@zagadka.ping.de> writes:

> Mikael Djurfeldt <mdj@mdj.nada.kth.se> writes:
> 
> > The bottom line is: GOOPS, as it is now, is clumsy, and I don't like
> > that!  It should be possible to design away this clumsiness.
> 
> I'll take a little inconvenience gladly when it saves me from
> unobvious, behind-the-scenes magic, that is hard to understand and is
> bound to hurt when it bites.

ok, how about the following (a variation on the current GOOPS design, 
actually, and with no magic involved):

(define-generic NAME ...)
  --> (define NAME (make-of-find-named-generic 'NAME ...))

(define-anonymous-generic NAME ...)
  --> (define NAME (make-generic ...))

(define-method NAME SPEC ...)
  - if NAME if defined in the current scope, then
    - if NAME is a generic, extend it
    - else error out
  - if NAME is not defined, do (define-generic NAME ...)

now, the only remaining place there magic may be required is at module
linking time, where there are two or more imported modules that export
the same name.  I suggest we just let the user specify that a given
exported name stands for a "named" generic function, so that the
module system can happily merge the exported names in this case (and
also check that the objects they denote are eq?).

--mike

-- 
For those who like this sort of thing, this is the sort of thing they like.
                                                                 -- fortune

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]