[ sisc-Feature Requests-1470820 ] Building child environments from any environment

"SourceForge.net" <[email protected]> Sat, 15 Apr 2006 06:25:50 -0700
Newsgroups gmane.comp.java.sisc.devel
Message-ID <[email protected]>
Feature Requests item #1470820, was opened at 2006-04-15 13:25
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=379537&aid=1470820&group_id=23735

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Scheme Code
Group: None
Status: Open
Priority: 5
Submitted By: Marco Bakera (pintman)
Assigned to: Nobody/Anonymous (nobody)
Summary: Building child environments from any environment

Initial Comment:
Some conversation taken from the mailing list.

----------------------------------------------------------------------

"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.


Matthias

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=379537&aid=1470820&group_id=23735


-------------------------------------------------------
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&kid=110944&bid=241720&dat=121642