scsh-users
[Top] [All Lists]

Re: How can I use the second argument to `load'?

To: Alan@lcs.mit.edu
Subject: Re: How can I use the second argument to `load'?
From: Richard Kelsey <kelsey@research.nj.nec.com>
Date: Mon, 22 Sep 1997 19:44:32 -0400
Cc: scheme48-bugs@martigny.ai.mit.edu, scsh-bugs@martigny.ai.mit.edu
Ah, now I know what is going on.  You are using `dump-scsh-program'
(or, equivalently ,build) to write the image, while I was using
,dump.  The difference is that ,dump automatically includes the
command interpreter while `dump-scsh-program' does not.  Both
,user-package-is and `get-package' depend on the command interpreter.

The following works because it bypasses the command interpreter
by using the lower-level procedure `with-interaction-environment'.

  % ./scshvm -i scsh/scsh.image
  Scsh 0.4
  > ,open environments package-commands-internal
  > ,config (define-structure test (export)
              (open scheme)
              (begin (define bar 10)))
  > (let ((env (get-package 'test)))
      (dump-scsh-program
        (lambda ignore
          (with-interaction-environment env
            (lambda ()
              (load "test.scm"))))  ; prints out the value of `bar'
              "test.image"))
  Load structure test (y/n)? y
  [test
  .
  ]
  Writing test.image
  #t
  > ,exit
  % ./scshvm -i test.image
  test.scm 
  bar = 10
  % 

I will track down the code responsible for the original
   Error: exception
          (record-ref #f 3)
message and have it produce somthing more perspicacious.

                                  -Richard

<Prev in Thread] Current Thread [Next in Thread>