[Top][All Lists]

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

MOP question

From: Eric E Moore
Subject: MOP question
Date: Mon, 15 Apr 2002 00:38:44 +0100
User-agent: Gnus/5.090004 (Oort Gnus v0.04) Emacs/21.2

The Goops MOP for generic application is basically undocumented.  I
tried to figure it out looking at goops.scm, but am a little lost.
Specifically, I can't quite figure out how apply-method is supposed to
work.  Mostly, how (next-method) gets bound.  

It looks to me like it's supposed to be passed as an argument to the
body of the method, but nothing I can see does that.

On top of that, calling apply-method directly doesn't work
(complaining about as I would expect, the wrong number of args to the
method body):

(use-modules (oop goops))

(define-class <foo> ()

(define-class <bar> (<foo>)

(define-method (baz (foo <foo>)) foo)
(define-method (baz (foo <bar>)) foo)

(define l (compute-applicable-methods baz (list (make <bar>))))

(define m1 (car l))
(define m2 (cadr l))

; stolen from apply-methods

(define next (lambda (procs args)
                   (lambda new-args
                     (let ((a (if (null? new-args) args new-args)))
                       (if (null? procs)
                           (no-next-method gf a)
                           (apply-method gf procs next a))))))

(apply-method baz l next (list (make <bar>)))     

Eric E. Moore

Attachment: pgpiCFgd3ENn5.pgp
Description: PGP signature

reply via email to

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