[Top][All Lists]

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

merging generic methods from different modules

From: Thomas Wawrzinek
Subject: merging generic methods from different modules
Date: Fri, 8 Dec 2000 08:33:17 +0100 (MET)


 > Are you sure you're getting the define-method macros evaluated in the
 > submodule environment, and are you sure you've not imported submod1 into
 > submod2 or vice versa? (- in which case I think the latter define-method
 > invocation will find an existing generic method to "attach to")

Hmm. It seems I've not evaluated the define-method in the module environment:

;; myfoo/foo.scm

(use-modules (oop goops))

(define-method baz ((x <vector>))
  (display "BAZ called for vector arg!") (newline))

(define-module (myfoo foo))

(export baz)

;; myfoo/bar.scm

(use-modules (oop goops))

(define-method baz ((x <list>))
  (display "BAZ called for list arg!") (newline))

(define-module (myfoo bar))

(export baz)

exec guile -s $0

(use-modules (oop goops) (myfoo foo) (myfoo bar))

(baz #(1 2 3))
(baz '(1 2 3))

When I tried it your way, with putting the define-module at the
beginning, it fails just as you say.

Seems I got trapped in some details here that I didn't appreciate
fully (I'm not sure I do now).

I'm actually using something like the above and was happy that it was 
working, but I'm no longer sure it's a good idea ...

On the other hand, *than* I'll really need a define-method that doesn't
override methods defined in other modules. 



reply via email to

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