This is the mail archive of the guile@sourceware.cygnus.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Undefined variable in goops.scm ?



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)
 
 
 ;;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]