Skip to content

WebR - Expreimental #93

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

Merged
merged 1 commit into from
Apr 17, 2024
Merged

WebR - Expreimental #93

merged 1 commit into from
Apr 17, 2024

Conversation

WebReflection
Copy link
Contributor

@WebReflection WebReflection commented Apr 16, 2024

This MR brings in most basic support for WebR with the following known caveats:

  • there is no synchronous version of WebR, everything is inevitably async
  • they decided to run out of the box in a worker as opposite of focusing on WASM <-> JS bindings and let actually consumers decide when the worker is desired (like every other runtime in here that works seamlessly and it can be moved into a worker still with full 1:1 bindings support, WebR breaks if it starts within a Worker for what I could test)
  • because everything is inevitably async, there is no difference between run and runAsync
  • because they offer various conversion of their returned data, it's a consumer exercise to explicitly (await result.toJs()).values or any other variant of the result
  • the FS currently is also async even if the Emscripten FS is sync ... on top of that, cwd() is missing so the writeFile within the interpreter wrap doesn't work and it throws an error
  • the JS module cannot be solved until generic JS objects are properly translated in WebR, which is not currently the case ... neither object literals or functions can apparently land so no import polyscript (or any other) is allowed
  • for the same reason the js_modules is not working neither
  • the worker attribute is useless, redundant, it actually breaks ... WebR always runs in a worker so do not use it
  • because everything is async, events as listeners cannot work as expected or do anything meaningful, also because events cannot cross JS -> WebR boundaries as their data.frame is not supported

That's it, that's the current state of WebR:

  • we can evaluate and define R code as content or external file
  • we can invoke those public functions from JS via runAsync (or run but it's async anyway)
  • we need to transform the returned value also async
  • we can pass numbers or primitives, array of primitives, or explicit data.frame values (tables) to R when invoking

/cc @ntoll

@WebReflection WebReflection force-pushed the webr branch 7 times, most recently from 19bf9ca to 0a42113 Compare April 17, 2024 09:41
@WebReflection WebReflection marked this pull request as ready for review April 17, 2024 10:04
@WebReflection WebReflection force-pushed the webr branch 3 times, most recently from 76b8bd1 to 8c762f1 Compare April 17, 2024 10:10
@WebReflection WebReflection merged commit 0f4ba9b into main Apr 17, 2024
2 checks passed
@ntoll
Copy link
Member

ntoll commented Apr 17, 2024

Bravissimo!

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

Successfully merging this pull request may close these issues.

2 participants