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         | [EMAIL PROTECTED]      | [EMAIL PROTECTED] | [EMAIL 
PROTECTED]
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.
_______________________________________________
Bug-guile mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-guile

Reply via email to