bug-guile
[Top][All Lists]
Advanced

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

[PATCH] GOOPS MOP no-method doesn't work


From: Andreas Rottmann
Subject: [PATCH] GOOPS MOP no-method doesn't work
Date: Sun, 25 Jan 2004 19:03:52 +0100
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux)

Hi!

I noticed that besides that <generic> specialization does not work
(see [0], this is apparently related to bugs/goops-apply-generic), the
no-method generic isn't invoked, because the C-based protocol does not
use it at all. Here is an example:


guile> (use-modules (oop goops))
guile> (define-generic foobar)
guile> (foobar)
 
Backtrace:
In current input:
   3: 0* [foobar]
 
<unnamed port>:3:1: In procedure foobar in expression (foobar):
<unnamed port>:3:1: No applicable method for #<<generic> foobar (0)> in call 
(foobar)
ABORT: (goops-error)
guile>

According to the MOP, no-method should be invoked, which in turn would
yield another error message (from oop/goops.scm):

(define-method (no-method (gf <generic>) args)
  (goops-error "No method defined for ~S"  gf))

The following small patch fixes the issue; however, I'm not sure if I
added the code "at the right place":

Index: oop/goops/dispatch.scm
--- oop/goops/dispatch.scm
+++ oop/goops/dispatch.scm
@@ -211,6 +211,8 @@
 (define (memoize-method! gf args exp)
   (if (not (slot-ref gf 'used-by))
       (slot-set! gf 'used-by '()))
+  (if (null? (slot-ref gf 'methods))
+      (no-method gf args))
   (let ((applicable ((if (eq? gf compute-applicable-methods)
                         %compute-applicable-methods
                         compute-applicable-methods)
Andy
-- 
Andreas Rottmann         | address@hidden      | address@hidden | address@hidden
http://yi.org/rotty      | GnuPG Key: http://yi.org/rotty/gpg.asc
Fingerprint              | DFB4 4EB4 78A4 5EEE 6219  F228 F92F CFC5 01FD 5B62

Python is executable pseudocode, Perl is executable line-noise.

reply via email to

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