From: Ken A. <kan...@bb...> - 2004-05-10 20:44:54
|
Yes, its fine to include the developers. There ideas can certainly help figure out how to proceed. Here's the tests you added: "05/05/2004" ;; multiple independent environments ;; I use true here to mean run during the test for side effects (let ((x 0) (js1 (JS.)) (js2 (JS.))) (true (begin (set! x 0) (.load js1 "(define x 1)") (.load js2 "(define x 2)") (display x)(newline))) (= x 0) (= (.eval js1 'x) 1) (= (.eval js2 'x) 2) (true (set! x 10)) (= x 10) (= (.eval js1 'x) 1) (= (.eval js2 'x) 2) (true (.eval js1 '(set! x 11))) (= x 10) (= (.eval js1 'x) 11) (= (.eval js2 'x) 2) (true (.eval js2 '(set! x 12))) (= x 10) (= (.eval js1 'x) 11) (= (.eval js2 'x) 12)) js1 and js2 are two independent Schemes along with the one that's evaluating this code. Since they are independent, it doesn't feel like there's a need to push and pop evaluators. What am i missing? Perhaps there are static methods in Scheme.java and other classes that should simply be removed. For example, Scheme.runJscheme() should no longer be static, so the currentEvaluator() call in that method wouldn't be necessary. runJscheme() would have to be moved to Evaluator, i guess. I think getting rid of the Scheme class might be the way to go. One thing we need to do is tweeze apart is construction of an Evaluator. It should probably take an environment as an argument. Of course, you may want to fill that environment with the right stuff, such as Primitives, which takes an evaluator. In fact, i see that Primitives and U are probably the first issues to get right. I think i understand what you did to take another wack at it, hopefully with help from Tim. k PS. Do you sail? Tim, compiling is broken because some generated code needs to be changed, but you can compile and run things with javac -classpath src src/jscheme/REPL.java java -classpath src jscheme.REPL At 07:37 AM 5/11/2004 +1200, Toby Allsopp wrote: >[I hope you don't mind me CCing this to the devel list.] > >The basic idea is so that you can be running under one evaluator and >then create a new one and run some isolated Scheme code. The tests I >added are examples of this. > >This could also be achieved by changing the JS.enter and JS.exit methods >to save and restore the previous evaluator, but I prefer it to be >explicit. The semantics of creating new threads are a bit easier to >understand with an explicit stack, in my opinion. > >Toby. > >On Mon, May 10, 2004 at 01:16:12PM -0400, Ken Anderson wrote: >> Why is there a stack of evaluators? >> >> k >> >> At 07:07 AM 5/10/2004 +1200, Toby Allsopp wrote: >> > Okay, here are the changed files. >> > >> > Toby. >> > >> > On Fri, May 07, 2004 at 08:12:43AM -0400, Timothy John Hickey wrote: >> > > Hi Toby, >> > > Could you send me a tar ball of the changed files? >> > > I'll have a look and test it out on some of my larger applications.... >> > > Thanks, >> > > ---Tim--- >> > > >> > > >> > > On May 6, 2004, at 9:15 PM, Toby Allsopp wrote: >> > > >> > > > After some delay, here is the promised patch that allows one JVM >> > > > to host multiple JScheme instances that are isolated (or not if >> > > > you want) from each other. I can provide the entire changed >> > > > files on request. >> > > > >> > > > Note that there are two new files: src/jsint/Evaluator.java and >> > > > src/jscheme/SchemeEvaluator.java and one removed file: >> > > > src/jsint/SI.java. |