Linking to prototypes and loadWithNewGlobal
sundararajan.athijegannathan at oracle.com
Mon Mar 14 04:08:26 UTC 2016
Yes, object from different (global) "world" are represented as
ScriptObjectMirror instances. Those are "almost" objects in that usual
foo.bar, foo.func() etc. would work - but those are still "foreign"
objects (just like Java objects are). And so such objects can not be as
proto (just as a Java object like a java.util.ArrayList instance can not
On 3/12/2016 8:29 AM, Eric Pederson wrote:
> I am trying to link to a prototype of a function loaded through
> loadWithNewGlobal. For example:
> var Foo = loadWithNewGlobal("foo.js");
> var foo = Object.create(Foo.prototype);
> This throws an exception: TypeError: [object Object] is not an Object.
> It works ok if I load the function using plain load().
> Is this expected?
> -- Eric
More information about the nashorn-dev