Scopes and load()

David P. Caldwell david at code.davidpcaldwell.com
Tue Sep 2 10:05:24 UTC 2014


Is this a bug?

scopes.js

with({ foo: "bar" }) {
var evaluated = eval("foo");
 print(evaluated);
var loaded = load({ name: "foo.js", script: "foo" });
 print(loaded);
}

$ jrunscript scopes.js
bar
script error in file scopes.js : ReferenceError: "foo" is not defined in
foo.js at line number 1

This is with jdk1.8.0_20.

-- David P. Caldwell
http://www.davidpcaldwell.com/


More information about the nashorn-dev mailing list