unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* MOP question
@ 2002-04-14 23:38 Eric E Moore
  2002-04-24  3:01 ` Thien-Thi Nguyen
  0 siblings, 1 reply; 3+ messages in thread
From: Eric E Moore @ 2002-04-14 23:38 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 1165 bytes --]


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> ()
  (slot1))

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

(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 #2: Type: application/pgp-signature, Size: 227 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-04-24 18:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-04-14 23:38 MOP question Eric E Moore
2002-04-24  3:01 ` Thien-Thi Nguyen
2002-04-24 18:36   ` Eric E Moore

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).