This is the mail archive of the guile@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] |
Now that goops is in CVS, I'm wondering if there are any scripts that are being used as tests to define and debug the behavior of the system? I tried to use the example complex number class that's in appendix c of the stk manual, but the goops'd guile didn't like it. Specificly it complains about the slots being undefined, failing on the first slot definition. Here's what I'm doing: (use-modules (oop goops)) (define-class <complex> (<number>) (;; True slots use rectangular coordinates (r :initform 0 :accessor real-part :init-keyword :r) (i :initform 0 :accessor imag-part :init-keyword :i) ;; virtual slots access do the conversion (m :accessor magnitude :init-keyword :magn :allocation :virtual :slot-ref (lambda (o) (let ((r (slot-ref o 'r)) (i (slot-ref o 'i))) (sqrt (+ (* r r) (* i i))))) :slot-set! (lambda (o m) (let ((a (slot-ref o 'a))) (slot-set! o 'r (* m (cos a))) (slot-set! o 'i (* m (sin a)))))) (a :accessor angle :init-keyword :angle :allocation :virtual :slot-ref (lambda (o) (atan (slot-ref o 'i) (slot-ref o 'r))) :slot-set! (lambda (o a) (let ((m (slot-ref o 'm))) (slot-set! o 'r (* m (cos a))) (slot-set! o 'i (* m (sin a)))))))) when evaluated with guile -s tells me: oops-complex-nums.scm:10:4: In expression (i :initform 0 ...): oops-complex-nums.scm:10:4: Unbound variable: i Help? -- Peter C. Norton Time comes into it. / Say it. Say it. spacey@pobox.com | The Universe is made of stories, http://spacey.static.inch.com | not of atoms. | Muriel Rukeyser "The Speed of Darkness"