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

Discussion: Would it be possible to have a webR standalone version? #166

Open
ceciliacsilva opened this issue Mar 9, 2023 · 2 comments
Open
Labels
question Further information is requested

Comments

@ceciliacsilva
Copy link

Good afternoon.

I have a question about the possibility of using WebR server-side (possibly with WASI):

  • Is there any expectation (or plan) to generate a WebR WebAssembly Standalone version?
    • Or if there have been any attempts to have something like this in the past?

I ask this because it would be extremely interesting to be able to use/test WebR server-side, mainly,
in experimental Serverless platforms (Function as a Service) that use Wasm as a containerization tool.

Thanks in advance.

@georgestagg
Copy link
Member

We have indeed discussed a version of R for WASI internally, and it is something we'll be interested in the future. However, there are a couple of blockers standing in the way right now.

The biggest is probably R's reliance on C's setjmp and longjmp. Wasm originally didn't have support for exceptions, and so Emscripten by default emulates the behaviour using JavaScript's try/catch. While browsers and node can execute JS code while running a Wasm binary, a pure Wasm engine may not have access to such a JS engine.

Luckily, the a Wasm exception-handling proposal exists, and Emscripten can emit code using the features introduced in that proposal to implement setjmp/longjmp, rather than dropping into JavaScript. Unfortunately, it looks like neither Wasmer nor Wasmtime supports Wasm exceptions yet.

Once Wasm exceptions are better supported by standalone Wasm engines, and if other useful proposals such as Wasm stack-switching are accepted and implemented, we might be able to revisit building R for WASI.

@JosiahParry
Copy link
Contributor

Adding a "verbal" vote for this support. It would make webR callable from Rust

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

No branches or pull requests

3 participants