Share context/JS bindings

Axel Dörfler axeld at pinc-software.de
Tue Jun 14 09:58:28 UTC 2016


Hi Benjamin,

Am 14/06/2016 um 11:06 schrieb Benjamin Sieffert:
> I tried doing a similar thing for a while and found there is no pretty
> way to do it from the Java-side.
> I think the best solution is making your JS-code have no global state,
> by utilizing function scopes* and maybe small (custom, mutable)
> context objects that get passed around.

Yeah, it looks like I'll just have to document the fact for the time 
being, and hope for future improvements :-)

> Generally, the public API for providing bindings etc. certainly looks
> nice, but in practice I think some use-cases might just be too
> complicated to be supported.

I think having a low overhead solution to reusing contexts would be very 
beneficial.
Another thing that I missed was Invocable supporting passing a 
ScriptContext.

Thanks!

Bye,
    Axel.


More information about the nashorn-dev mailing list