iodide-project / iodide

Literate scientific computing and communication for the web
Mozilla Public License 2.0
1.49k stars 142 forks source link

rust language support #2401

Open mash-graz opened 5 years ago

mash-graz commented 5 years ago

i'm just curious, if someone already has started to develop support for the rust language for iodide?

for jupyter there is evcxr available to evaluate little rust fragments in a notebook like manner. using its core library in iodide/pyodide would IMHO make a lot of sense, because rust and its WASM retated features are already used for the developement of this software. it would also help to make the extensibility and self-documetation of iodide more powerful. better integration and support for rust- resp. WASM-based components like plotters could significantly improve the performance of iodide in comparison to traditional java script based approaches.

wlach commented 5 years ago

This would be interesting, I guess the main question would be how to compile rust to webassembly should that it could be executed in the browser. There's two options here:

  1. Porting emscripten itself to webassembly (sounds really hard) and compile rust inside the brwoser
  2. Having a server-side process for accepting code fragments and returning webassembly as a response (also hard, but probably far more tractable)

If you just wanted to run a specific WASM component inside Iodide, that's far easier: the process should be basically the same as it is for any other JavaScript library. You can either import it directly inside the notebook or write a language plugin to make that more convenient. The vegaLite plugin that I've been experimenting with would be an example of the latter:

https://definitely-staging.iodide.io/notebooks/173/

mash-graz commented 5 years ago

yes -- you are right! it doesn't look like an easy task to prepare the necessary tools as web/wasi components. all the practical implementaions, which try to solve similar tasks (evcxr, rust-playground and webassembly studio) actually handle it in a client-server manner by utilizing native tools on the host side. but eliminating this requirement is IMHO exactly the most fascinating feature of your software.

i just wrote a question concerning this topic on the relative vivid reddit rust board. maybe someone else can give us a hint, how to solve this desire.

but thanks for your kind reply