Replies: 23 comments 52 replies
-
Personally, I think we should do something along these lines:
|
Beta Was this translation helpful? Give feedback.
-
Putting Java interop behind a flag / simple configuration sounds like a reasonable approch for RingoJS. We rely on the interoperability at a broad range. Keeping the mechanism / naming the same is crutial for us, but it should be not a big problem to ship a major release RingoJS version with Rhino 2.0 having all necessary flags enabled. To let old ballast behind, continuations and E4X should be dropped / marked as unsupported with a 2.0 release. |
Beta Was this translation helpful? Give feedback.
-
I've mentioned in a couple other issues recently that e4x is still heavily used (as is Java interop) in user written code in NextGen (Mirth) Connect, which serves the global healthcare market. Much of the user written code is transforming xml. Dropping e4x support would effectively mean that they would not be able to move past 1.7.15, as most user written code would cease to work. I am unaware of any comparable technologies (as far as ease of use, feature completeness, and runs in Rhino) for transforming xml in javascript that could be used to replace it. Should there be any effort to allow version 2.x to run in the same JVM as 1.7.x to allow for transitioning legacy user code to the newer engine? Also, how do you do anything network related without Java interop? Rhino doesn't have any of the mechanisms found in the browser or node.js to do anything network related. |
Beta Was this translation helpful? Give feedback.
-
Probably worth a separate issue, but I'd prefer that the "fetch" API be in
a separate package that can be optionally included, for a number of reasons:
1. Embedders not only won't use it, but can't have it because it'll
introduce a brand new security hole. It must be something that an embedder
turns on by default.
2. I'm not even sure it should be a default part of the Rhino shell,
again because of security.
3. It'll depend on some HTTP client library, and to date Rhino has no
dependencies and should stay that way.
setTimeout, however, doesn't have any of those limitations. I'm thinking of
adding it to the "Global" object (which is used by the shell and is used in
the tools package.) It's a good way to exercise the Promise code more, and
in fact the tests in kangax/compat-table require it, or at least did the
last time I looked.
…On Wed, Jun 30, 2021 at 12:41 PM Paul Bakker ***@***.***> wrote:
Similar to setTimeout(...) the fetch api isn't part of EcmaScript, but
part of the Web API <https://developer.mozilla.org/en-US/docs/Web/API>.
As such, I'm of the opinion that it shouldn't be part of the core of
Rhino/be there by default, but depending on your use-case, it would be
handy to have (and not have everyone reimplement the same thing over and
over again).
Not sure what the best way would be to go about it. Neither GraalJS or
NodeJS offers it in the code, but utilize the node-fetch package. Maybe, if
there is enough interest, someone could setup a side project to that
provides the relevant Web API's as additional built-ins
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#972 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAD7I26BWE7FFWEMH2QFXX3TVNXOZANCNFSM47R2QNUQ>
.
|
Beta Was this translation helpful? Give feedback.
-
For optional stuff like setTimeout, console, load, etc, I like the current
approach -- by default, Rhino has none of that, and you can even use the
"runtime" JAR and not even have it in your classpath. But you can instead
use the full JAR and load the Global object and then you get all of them.
Do we think that there's a case in which a user would want setTimeout but
not "print," etc? That would then call for a more modular implementation.
…On Wed, Jun 30, 2021 at 1:01 PM Paul Bakker ***@***.***> wrote:
Indeed setTimeout is something very useful with Promises.
Question is if We'd go for a very clean Context.VERSION_ECMASCRIPT that is
really only what EcmaScript specifies and then flag/options/xxx for
embedders to add more stuff as they wish (E4X, Continuations, Java Access
etc etc), whether setTimeout is one of those opt-ins, or something that we
just add by default. GraalJS doesn't, NodeJS does. I'm leaning towards not
adding it by default
Same could be argued about console
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#972 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAD7I2ZRXZRKZWMIZXYNLTTTVNZXZANCNFSM47R2QNUQ>
.
|
Beta Was this translation helpful? Give feedback.
-
I'll write down what I know. (Updated as needed) JavaScript 1.8 (Mozilla extension)https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Deprecated_and_obsolete_features Expression closureshttps://developer.mozilla.org/en-US/docs/Archive/Web/JavaScript/Expression_closures function(x) x*x Conditional catch clausehttps://esdiscuss.org/topic/conditional-catch-clause try {
} catch (e if e === 1) {
} catch (e if e === 2) { // multiple catch clauses
} Array comprehensionrhino/testsrc/jstests/harmony/for-of.js Lines 114 to 116 in aac4a4e Legacy generatorfunction() { yield 1; } // without *
|
Beta Was this translation helpful? Give feedback.
-
@gbrail didn't you have ideas on possible ending support for Java 8 at some point, as to be able to be able to take advantage of newer JVM features that would enable ways to improve performance? @rbri think you mentioned before that you've run into things you'd like to fix, but that that would mean breaking the public Java API. Care to add? |
Beta Was this translation helpful? Give feedback.
-
As for optional additions: another thing that might be interesting for some would be having the ability to add the API as used by Nashorn and GraalJS for interacting with Java classes: both seem to have chosen a different approach to what Rhino has always done. If offered as an add-on, it might aid in people trying out Rhino |
Beta Was this translation helpful? Give feedback.
-
What about Tail call optimization(TCO)? Rhino only supports this in Interpreter mode. (I haven't checked to see if it meets the specifications.) rhino/src/org/mozilla/javascript/CodeGenerator.java Lines 622 to 629 in 3e205d7 |
Beta Was this translation helpful? Give feedback.
-
Another area where we have incompatibilities, see #213 Flagging such cases with label |
Beta Was this translation helpful? Give feedback.
-
Point 1 is spot on. As for 2, I think you could use continuations to implement await, in the following way:
When reaching an `await` keyword:
1. start the awaited-for promise in another thread
2. capture a continuation of the main program at the `await` (technically that would involve implementing `await` as a continuation capture)
3. Wait for the promise to resolve in some promise-handling thread.
4. Invoke the continuation from step 2 with the resolved value from step 3.
… On 5 Jul 2021, at 12:10, Paul Bakker ***@***.***> wrote:
Tnx for your insight.
Sounds like a Continuation is more like await when making calls to async functions in JavaScript, with the difference that:
with async/await there's no Continuation object that you can grab hold of in JavaScript,
nor can you pass a parameter to the continued computation (except for the await returning the value from the awaited function)
Does that come close?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub <#972 (reply in thread)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AAOZIJHW6LOG3WM56A5ZF5LTWFZIBANCNFSM47R2QNUQ>.
|
Beta Was this translation helpful? Give feedback.
-
Should probably also change the default value of WrapFactory.javaPrimitiveWrap from true > false in a context.VERSION_ECMASCRIPT, so Java primitives are exposed in JS land as JavaScript primitives, instead of as wrapped Java objects. Begs the question if we should also do something similar with Java primitives that map onto BigInt or one of the TypedArray variants Or Date instances, see #89 (comment) |
Beta Was this translation helpful? Give feedback.
-
More non-standard stuff can be found by looking at the release notes for Mozilla's JavaScript versions, see New in JavaScript, for example Array and String generics in New in JavaScript 1.6 |
Beta Was this translation helpful? Give feedback.
-
Am planning to, in a few weeks, wrap up this discussion and try to create a proposal on how to move forward on this. @gbrail and @rbri: could you share their thoughts on area's you know of where, in order to move the needle forward on Rhino, we might have to break backwards compatibility? Also, would be great if some of the previous maintainers/contributors of Rhino, like @hns, @szegedi and @anba could chip in and give us their insight on this topic, as they all have tried to move the needle in the past, but ran into having to break backwards compatibility in order to do so (I believe) |
Beta Was this translation helpful? Give feedback.
-
That makes sense to me too. Glad to hear from users of those features!
…On Wed, Sep 29, 2021 at 12:54 AM Paul Bakker ***@***.***> wrote:
Thnk the concensus is that features like E4X and Continuations are things
that make Rhino stand out form the rest and thus should indeed remain
supported
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#972 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAD7I26F2Q3QRVKRHICYXGLUELA4ZANCNFSM47R2QNUQ>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
Beta Was this translation helpful? Give feedback.
-
I would like to annunce #827 for v1.8/v2.0 as it introduces an API change in the WrapFactory. |
Beta Was this translation helpful? Give feedback.
-
As per https://openjdk.java.net/jeps/411: the Java Security Manager is going to be deprecated for removal, so to keep Rhino compatible with newer Java versions, We'll need to remove the dependancy on the Java SecurityManager (in RhinoSecurityManager) at some point as well |
Beta Was this translation helpful? Give feedback.
-
Another pointer to a partial list of things where Rhino adds non-standard stuff: https://wiki.openjdk.java.net/display/Nashorn/Rhino+Migration+Guide#:~:text=the%20JavaScript%20method.-,Compatibility%20script,-There%20are%20few |
Beta Was this translation helpful? Give feedback.
-
Maybe we ought to, at some point, also add the same API as Graal(/Nashorn) for interacting with Java, as per https://www.graalvm.org/reference-manual/js/JavaInteroperability/#access-java-from-javascript |
Beta Was this translation helpful? Give feedback.
-
FYI: I've setup 2 projects, v1.7.15 and v2.0.0 as a start to convert everything that has been said in this discussion into cases and group them into projects/releases. |
Beta Was this translation helpful? Give feedback.
-
Locking this discussion: all (still relevant) idea's & comments have been put into cases somewhere |
Beta Was this translation helpful? Give feedback.
-
This is a long long discussion, but I'm ready to say that Rhino can move beyond Java 8 after 1.7.14. Later Java versions are getting pretty ubiquitous, and the log4j thing helped push some people along. I'd like to propose Java 11 as the new baseline going forward, with support for newer versions of course. Does that make sense? |
Beta Was this translation helpful? Give feedback.
-
To all that participated in this discussion, see the follow-up discussion: #1363 |
Beta Was this translation helpful? Give feedback.
-
After the release of v1.7.14, we're onto the next version.
In the past there's been discussion to move from v1.7 to v1.8 or v2.0. The premise of that discussion is that there are (a few) things in the Rhino codebase that might require a backwards-incompatible change to the public API in order to support/fix:
this
handling in strict mode #940 + references linked in the caseAlso, fixing behavioral issues within the current
Context.VERSION_ES
language version already poses a problem with regards to backwards compatibility, because they would break implementations that currently already use theContext.VERSION_ES
language version.See label Ecma Incompatibilities for some identified examples.
Maybe scraping MDN and looking for non-standard stuff (like RegExp.lastParen) is a good way to find non-compatible extensions given that Rhino & SpiderMonkey (where a lot of these non-standard extensions come from) share a history. These searches on the MDN doc (source) at least reveals some: https://github.com/mdn/content/search?q={{deprecated_header}}+path:files/en-us/web/javascript/ and https://developer.mozilla.org/en-US/search?q=deprecated. This is another list the MDN tracks itself (but doesn't seem complete): https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Deprecated_and_obsolete_features
Another option to find incompatibilities is run the tests from test262/annexB and see which tests pass, as stuff under testing in /annexB should only be implemented by browsers
With this discussion I hope to find consensus on the plan to move forward
Beta Was this translation helpful? Give feedback.
All reactions