Stack scopes / bindings?
sundararajan.athijegannathan at oracle.com
Fri Jan 30 04:38:53 UTC 2015
A script engine has an associated (default) ScriptContext instance. A
ScriptContext has ENGINE_SCOPE and GLOBAL_SCOPE bindings in it.
ENGINE_SCOPE which is the same as a "global" object of ECMAScript (has
properties like "Object", "Function", "undefined", "parseInt" etc.). If
a variable is missing in ENGINE_SCOPE, then it is searched in GLOBAL_SCOPE.
For more details, please check out
Hope this helps,
On Thursday 29 January 2015 07:30 PM, Nicolas ALBERT wrote:
> I used to use Rhino and to stack scope through Scriptable.setParentScope
> I can not find an equivalent with Bindings or ScriptContext.
> - if a variable is defined without var, it's a global variable (root
> - if a variable is defined with var, it's a local variable (current
> - if a variable is accessed or modified, engine lookup in its current
> scope, and parent, and parent parent ... and the global scope
> I miss something or this behavior (with setParentScope) doesn't exist ?
More information about the nashorn-dev