reactiverse / es4x

🚀 fast JavaScript 4 Eclipse Vert.x
https://reactiverse.io/es4x/
Apache License 2.0
882 stars 75 forks source link

Timeout globals: Not be based on vertx #489

Closed StephenOTT closed 3 years ago

StephenOTT commented 3 years ago

Hey

The timeout globals: https://github.com/reactiverse/es4x/blob/master/docs/advanced/globals.md. It would be great for the gralljs community if they were not based on vertx so non-vertx projects can easily implement the code as a require.

pmlopes commented 3 years ago

There are 2 reasons for this:

  1. graaljs does not implement them
  2. not relying on vert.x will also mean that the scheduling is not guaranteed to be run on the right thread. This creates 2 problems: 2.1. graaljs will not allow running on different threads 2.2. if you're on the wrong thread or event loop all the guarantees/safety that vert.x does for you regarding concurrency are voided

But indeed, if graaljs would implement those they would be more portable for all users but due to their strict "single thread" rule, it becomes hard to deliver as the scheduler would then need to be shared with the runtime where it runs.