jsvm icon indicating copy to clipboard operation
jsvm copied to clipboard

JSR-223 support

Open rsommerard opened this issue 8 years ago • 2 comments

Hi, are you planning to support the JSR-223 ?

https://docs.oracle.com/javase/8/docs/technotes/guides/scripting/prog_guide/api.html

rsommerard avatar Apr 20 '17 15:04 rsommerard

Currently not. I've taken a look at the JSR-223 interfaces. They are not very different from the ones used in JSVM, but there are serveral, important differences. The biggest one is that JSVM uses JSValue wrapper objects with methods such as .asInt() whereas JSR-223 uses unwrapped Java objects and Java casts (e.g. (Double) value).

One feature JSValues provide that would be impossible to support with unwrapped values is accessor chains, which provide better error messages on bad casts. (See https://github.com/ntrrgc/jsvm/wiki/Accessor-chains-for-type-error-messages)

What would be the value in supporting JSR-223? So far, from skimming over the technical notes the only advantage I can see is ease of migration from Nashorn to JSVM.

ntrrgc avatar Apr 21 '17 13:04 ntrrgc

Yep the value would be to be able to easily change the jsvm engine by an other one without change the application code that use it.

Nevermind, thanks for your answer. 😃

rsommerard avatar Apr 24 '17 08:04 rsommerard