Is there a way to get a reference to a package outside of the config
package? For example, suppose I define a structure called foo in the
config package, then suppose in some package (possibly foo itself) I
want to call:
(eval form foo)
How do I access a binding of the foo package?
I couldn't think of any way to accomplish this generally. So I backed
off and tried to create a local configuration package exporting
foo. This failed (Error: undefined variable .make-reflective-tower.).
Even if this succeeded, I think that packages in config would be able
to reference packages exported by local-config, but packages in
local-config still couldn't reference themselves or any other packages
in local-config.
Any ideas?
By the way, I solved the immediate problem without help from the
module system:
(define-structure foo
(export eval-in-foo)
(open scheme)
(begin
(define eval-in-foo
(let ((foo-package (interaction-environment)))
(lambda (form) (eval form foo-package))))))
This is workable for the problem at hand, but somehow, it feels like
I'm cheating, and that I must be overlooking something important.
-Tony Carrico
PS: Note that this will not work:
(define-structure foo
(export eval-in-foo)
(open scheme)
(begin
(define eval-in-foo
(lambda (form) (eval form (interaction-environment))))))
|