X
xyzzy12
http://download.java.net/jdk6/doc/api/javax/script/package-summary.html
I think there may be a large flaw in the javax.script in regards to the
scoping constants of ENGINE_SCOPE and GLOBAL_SCOPE. How I read it,
there may be a limitation of a stack depth of 100.
public static final int ENGINE_SCOPE 100
public static final int GLOBAL_SCOPE 200
Notice these methods:
Object getAttribute(String name) Retrieves the value of the
attribute with the given
name in the scope occurring earliest in the search order. The order
is determined by
the numeric value of the scope parameter (lowest scope values first.)
int getAttributesScope(String name) Get the lowest scope in which an
attribute is
defined. The lowest scope. Returns -1 if no attribute with the given
name is defined
in any scope.
Thus it is clearly implied that as the stack depth increases, the scope
value decreases. However, the lowest value for the scope variable is
defined as -1, thus this limits it to a stack depth of 100. My belief
is that the GLOBAL and ENGINE constants should be set to 0 and 1,
respectively, and allow the the scope stack to grow from 2 to
MAX_VALUE.
Any thoughts?
I think there may be a large flaw in the javax.script in regards to the
scoping constants of ENGINE_SCOPE and GLOBAL_SCOPE. How I read it,
there may be a limitation of a stack depth of 100.
public static final int ENGINE_SCOPE 100
public static final int GLOBAL_SCOPE 200
Notice these methods:
Object getAttribute(String name) Retrieves the value of the
attribute with the given
name in the scope occurring earliest in the search order. The order
is determined by
the numeric value of the scope parameter (lowest scope values first.)
int getAttributesScope(String name) Get the lowest scope in which an
attribute is
defined. The lowest scope. Returns -1 if no attribute with the given
name is defined
in any scope.
Thus it is clearly implied that as the stack depth increases, the scope
value decreases. However, the lowest value for the scope variable is
defined as -1, thus this limits it to a stack depth of 100. My belief
is that the GLOBAL and ENGINE constants should be set to 0 and 1,
respectively, and allow the the scope stack to grow from 2 to
MAX_VALUE.
Any thoughts?