This is the mail archive of the
guile@sourceware.cygnus.com
mailing list for the Guile project.
Undefined variable in goops.scm ?
- To: Thierry Bezecourt <thbz at worldnet dot fr>
- Subject: Undefined variable in goops.scm ?
- From: Eric Moore <moore at chem dot cmu dot edu>
- Date: Mon, 10 Jan 2000 05:32:18 -0500 (EST)
- Cc: guile at sourceware dot cygnus dot com
- References: <3.0.5.32.20000110102732.013fbac0@edelweb.fr>
Thierry> I receive an error when I try to use an accessor on a
Thierry> "virtual" slot in a Goops object. Consider for example the
Thierry> following code (from the Guile shell or loaded from a file) :
Thierry> (use-modules (oop goops))
Thierry> (define-class <person> ()
Thierry> (age #:allocation #:virtual
Thierry> #:accessor age
Thierry> #:slot-ref (lambda (o) 42)
Thierry> #:slot-set! (lambda (o v) 43)))
Thierry> (define paul (make <person>))
Thierry> (age paul)
Thierry> => ERROR: In expression (assert-bound 42 o):
Thierry> ERROR: Unbound variable: assert-bound
Thierry> ABORT: (misc-error)
I looked briefly at this and it looks like the problem is that
assert-bound is used in a local-eval in
make-generic-bound-check-getter but is not exported into the (oop
goops) module, so when guile tries to evaluate the expression, it
can't find assert-bound. Adding assert-bound to the export list in
goops.scm fixes the problem nicely, I have no clue if something
else might be cleaner/better :) But here's a patch anyway ;)
Index: goops.scm
===================================================================
RCS file: /cvs/guile/guile/guile-oops/goops.scm,v
retrieving revision 1.53
diff -u -r1.53 goops.scm
--- goops.scm 1999/12/24 00:13:40 1.53
+++ goops.scm 2000/01/10 10:33:03
@@ -76,7 +76,7 @@
generic-function-methods method-generic-function method-specializers
primitive-generic-generic enable-primitive-generic!
method-procedure slot-exists? make find-method get-keyword
- %logand)
+ %logand assert-bound)
;;