[plt-scheme] Organizing Code, Pt.2

From: Danny Yoo (dyoo at hkn.eecs.berkeley.edu)
Date: Tue Mar 14 00:54:31 EST 2006

> (module module-a
>    (lib "swindle.ss" "swindle")
>
>    (defclass test-parent()
>       (name :accessor name :initarg :name))
>
>    (provide test-parent))
>
> Requiring this module allows me to create instances of the class but
> inspecting these instances fail:
>
> => (require (lib "swindle.ss" "swindle"))
> => (require "module-a.scm")
> => (define tp (make test-parent :name "Parent"))
> => (display-object tp)
> #<test-parent:Parent>=> (name tp)
> reference to undefined identifier: name


Hi Kevin,

I'm not too familiar with CLOS yet, but does SLOT-REF do what you want?

;;;;;;
> (slot-ref (make test-parent :name "Parent") 'name)
"Parent"
;;;;;;


Best of wishes!



Posted on the users mailing list.