[plt-scheme] Organizing Code, Pt.2

From: Kevin A. Smith (kevin at hypotheticalabs.com)
Date: Mon Mar 13 21:59:04 EST 2006

First off, thanks to everyone who responded to my first question. All of 
the information has been very enlightening, especially the HtUS site.

I'm hung up on finding the proper way to export Swindle classes from a 
module. Here's the approach I've been taking:

(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

=== context ===
repl-loop
=>

I've also tried adding (provide all-from "swindle.ss" "swindle") to the 
module definition but that only changes the error message to:
name: no applicable primary methods for argument types 
(#<class:test-parent>)

=== context ===
#<path:/home/ksmith/plt/collects/swindle/tiny-clos.ss>:130:4: loop
repl-loop

I've been stuck on this for a couple of days, so I thought I'd ask the 
list. I'd really appreciate any information about how to do this.

--Kevin


Posted on the users mailing list.