guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: goops and memoization


From: Neil Jerram
Subject: Re: goops and memoization
Date: 21 Nov 2002 23:50:20 +0000
User-agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7

>>>>> "Mikael" == Mikael Djurfeldt <address@hidden> writes:

    Mikael> (An alternative solution is to implement compile-method in
    Mikael> C, memoizing the source code while walking through it.  In
    Mikael> fact, that could mean that we don't need to call
    Mikael> procedure-source => no need to unmemoize code.)

A further possibility occurs to me - transforming the method
definition at define-method time something like this:

(define-macro (make-method gf specializers formals . body)
  `(letrec ((m (lambda ,formals
                 (define (next-method)
                   (call-next-method ,gf
                                     ,specializers
                                     m
                                     ,@formals))
                 ,@body)))
     m))

Given the gf and specializers, call-next-method works out a list of
applicable methods (probably cached) in the same way as for a normal
gf application, then it looks through this list for m and applies the
method after m to the supplied arguments (formals).

Would this kind of approach work?

        Neil





reply via email to

[Prev in Thread] Current Thread [Next in Thread]