design flaw with scope in javax.script??

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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,570
Members
45,045
Latest member
DRCM

Latest Threads

Top