Re: Reset an interpreter instance

"Marco Bakera" <[email protected]>
Newsgroups gmane.comp.java.sisc.user
Message-ID <[email protected]>
On 4/15/06, Matthias Radestock <[email protected]> wrote:
> "Marco Bakera" <[email protected]> writes:
>
> > The "problem" is that I get user input to be evaluated by a previously
> > with some of my own definitions inited interpreter instance. Although
> > it's possible to create such a new interpreter each run and init it
> > with some of my definition this process takes some time I wanted to
> > get rid off.
> >
> > Perhaps I can speed up the process by putting my own definitions into
> > the heapfile. But I didn't tried that. I just wanted to know whether
> > there may be a shorter way for me by simply calling (reset) or
> > something like this. ;)
>
> One way to accomplish what you want is to compile all your code, which
> will make it fast to load, and then load it into a fresh environment in
> which you subsequently evaluate the user code. Something along the lines
> of
>
> (define e (sisc-initial-environment))
> (eval '(load "your-code.scc") e)
> (eval user-code e)
>
> The environment you get from sisc-initial-environment is a child
> environment of the environment which contains all the bindings from the
> heap. Because it is a child env, any additions or modifications will not
> affect the parent environment.
>
> I think this is the best you can to do for the time being, without
> hacking into the sisc internals via s2j. I reckon there should be a
> better way though: One should be able to create child environments of
> *any* environment. Then you could write something like:
>
> (define e (sisc-initial-environment))
> (eval '(load "your-code.scc") e)
> (define ee (child-environment e))
> (eval user-code ee)
>
> and only repeat the last two steps in order to evaluate code in an
> environment that contains all heap bindings plus your own code. Please
> raise a feature request for this.
>

I tried something similar which didn't do it but I don't know why.
Perhaps you could give me some hint. :)

After compiling some sources a.scm into a.scc and loading it with
(load "a.scc") I got an exception by evaluating some function inside
the compiled code:

sisc.interpreter.SchemeException: ((message . "undefined variable
'lset-difference'."))

lset-difference is in srfi-1 and a.scm does require it with
(require-extension (srfi 1)). However the compiled version of a.scm
does not know about this.

Is this a bug or did I use something wrong?


Greetings,
Marco.

PS
However I will report the feature you mentioned to the bugtracker.

--
,----[ /X\arco -- www.bakera.de ]----
|         (Y F) = (F (Y F))
`----[ www.bulb-publications.de ]----


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid0944&bid$1720&dat1642
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.