OK, I'm stumped. Here's the story:
First off, I'm actually using Scsh version 0.4.4, so I'm really asking a
question about Scheme48 version 0.36 here -- but my problem has nothing to
do with scsh (I don't think), or any particular version of scheme48, but is
actually about how to make the Package system do what I want.
So I've got this little extension to Scheme that I want people to be able
to use. It's pretty simple, just a couple of additional defining forms
added to the standard Scheme language. The new forms are all exported
through the `layout-language' structure. Then I define a package called
`user-layouts' for my users to use:
(define-structure user-layouts (export)
(open layout-language
scheme
))
Then, I want to be able to `load' my users files into this package.
No, my users do not want to have to write `define-structure' definitions
for their files that open `layout-language' themselves -- we're already
stretching things just by using S-expressions. Having to explain the
Scheme48 module system to them would not fly.
I can almost get what I want by doing:
(load "foo" (get-package 'user-layouts))
Which is ugly enough given that `get-package' is this undocumented
procedure that I have to access from a structure named
`package-commands-internal'. But it works. Except if I dump my system out
-- which I -really- need to do to make its startup time less than glacial
-- then the call to `get-package' results in:
Error: exception
(record-ref #f 3)
So I'm guessing that the act of dumping an image (however it is that Scsh
and/or Scheme48 does that) probably integrates all the package information
away, and there isn't any environment in the `user-layouts' package any
more when the system starts up again. (But maybe I'm confused here, I've
narrowed it down to the call to `get-package' using the old
insert-print-statements debugging technique, so I'm not sure I -really-
know what's going on...)
So how can I win here? All I want to be able to do is create an acceptable
second argument to `load' (or `eval') that contains the standard Scheme
language, plus the names from one structure.
|