Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

does not work on Nashorn #64

Closed
salomvary opened this issue Nov 27, 2014 · 13 comments
Closed

does not work on Nashorn #64

salomvary opened this issue Nov 27, 2014 · 13 comments
Labels

Comments

@salomvary
Copy link

Due to the lack of setTimeout (and all the other alternatives).

(Nashorn is the successor of Rhino).

@stefanpenner
Copy link
Owner

@salomvary ooo, I want to make this work.

@stefanpenner
Copy link
Owner

issue opened on parent project: tildeio/rsvp.js#330

I'll have this sorted out by the end of the weekend.

@salomvary
Copy link
Author

@stefanpenner fyi i'm using this to polyfill setTimeout https://gist.github.com/salomvary/5a295d32e0868ffde42a
(I have no idea how good it is though. There should probably be a better way of doing it.)

@stefanpenner
Copy link
Owner

looks like platform has a hook for next micro task.

@stefanpenner
Copy link
Owner

tildeio/rsvp.js#334 i'll bring that over here after i fix + update the build tooling

@stefanpenner
Copy link
Owner

@salomvary so, I'm dubious of this. Nashorn doesn't have the same run to completion model that essentially all other JavaScript environments have. The threading model allows virtually all of our code to be re-entrant. I don't believe we can reasonable ensure correctness if threads are being used without much more effort.

I am open to suggestions or ideas on this..

@salomvary
Copy link
Author

Even Oracle is warning us on correctness when it comes to threading vs. nashorn. I'm not an expert of the field, can't give better suggestions atm

@stefanpenner
Copy link
Owner

this requires some additional runtime guarantees, we likely need to run all code touching promises in something that ensures run-to-completion.

Maybe someone smarter then I has some ideas, but i believe this is out-of-scope of this project for now.

Will reopen if some reasonable solution exists, but I believe this requires a runtime to wrap the code interacting with promises. Which likely would be another project itself

@salomvary
Copy link
Author

Maybe someone smarter then I has some ideas, but i believe this is out-of-scope of this project for now.

Maybe someone from the Oracle team has recommendations? @szegedi wdyt?

@stefanpenner
Copy link
Owner

I am very open to recommendations :)

@maximenajim
Copy link

Thanks, @stefanpenner, for looking into this. Have you by chance seen this talk by @william-tran about server-side JavaScript with Nashorn and Spring? https://youtu.be/kVyVyRdxwxE?t=1h17m37s
They seem to have a working solution for JavaScript promises in Nashorn (unfortunately, this project remains closed-source - awaiting sponsorship).

@h0ru5
Copy link

h0ru5 commented Dec 21, 2015

any news on this? said talk pointed towards ListenableFuture, but I did not get it to work...

@stefanpenner
Copy link
Owner

@h0ru5 no, as mentioned above we could provide a serializable/thread-safe runtime around/integrated into nashorn to enable this, but I am unaware of something we can use today.

The introduction of real threads in nashorn, really makes it incompatible with vast amounts of existing JavaScript.

Although the above sounds like fun to implement, I really can't justify the time right now (non of my responsibilities have need for it)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants