script engine with no global environment (java)

Posted by user1886930 on Programmers See other posts from Programmers or by user1886930
Published on 2012-12-10T17:02:33Z Indexed on 2012/12/10 17:29 UTC
Read the original article Hit count: 224

Filed under:
|
|
|
|

I am curious about how global variables are handled by script engines. I am looking for a script engine that does not preserve the state of global variables upon invocation. Are there such engines out there? We are looking for a scripting language we can use under the script engine API for Java.

When making multiple invocations of a script engine, top-level calls to eval() or evaluate() method preserves the state of global variables, meaning that consequent calls to eval() will use the global variables as they were left by the last invocation. Is there a script engine that does not preserve the state, or provides the ability to reset the state, so that global variables are at their initial state every time the script engine is invoked?

© Programmers or respective owner

Related posts about java

Related posts about JavaScript