Is there a language-independent way to add a function to JSR223 scripting bindings?

情到浓时终转凉″ 提交于 2019-12-01 09:29:51

If you look at javascript engine source code you'll find how oracle/sun implemented 2 functions (print, and println) which are magically (or not so magically) present when you fire up your engine.

Those function are 'scripted' , which is more or less what you did.

What I would do is : load and evaluate a bootstrap.[language_extension] before evaluating any other input in the new context.

You could easily create such scripts for each language you intend to support.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!