Project

General

Profile

Actions

Misc #18761

open

provide an example wasm project

Added by grosser (Michael Grosser) over 2 years ago. Updated 8 months ago.

Status:
Assigned
[ruby-core:108455]

Description

Neither the release notes nor the wasm/README.md include any runnable examples.
Please provide a docker image that can be used to generate a wasm binary (even if it's just "hello world"),
to show how this is supposed to work.

Updated by katei (Yuta Saito) over 2 years ago

  • Assignee set to katei (Yuta Saito)

Thank you for reporting. ruby/ruby.wasm repository provides a simple example and prebuilt rubies to try it easily. https://github.com/ruby/ruby.wasm#quick-example-how-to-package-your-ruby-application-as-a-wasi-application

Is this enough for your case, or need more getting started instructions?

Updated by rkh (Konstantin Haase) over 2 years ago

grosser (Michael Grosser) wrote:

Neither the release notes nor the wasm/README.md include any runnable examples.
Please provide a docker image that can be used to generate a wasm binary (even if it's just "hello world"),
to show how this is supposed to work.

I assume the final release will have an official .wasm file that ships with it.

Note that the current approach isn't to compile Ruby scripts to wasm, but to compile CRuby itself to wasm and use WASI or a custom interface to run Ruby code (ie, the Ruby code is sent as source code to the wasm binary).

You can find pre-compiled wasm files on GitHub: https://github.com/ruby/ruby.wasm/releases

Updated by rubyFeedback (robert heiler) over 1 year ago

need more getting started instructions?

I think it may be helpful if there would be something like a "mini-tutorial", in the sense that you could go from a super simple use case (hello world), towards something that is a bit more useful (something like tic-tac-toe, in the browser, or even just something simpler, like a mini-calculator), to a tiny bit more advanced (but not too overly complicated) example. Something that is a bit more advanced, without being too complicated. Something that can demonstrate possible use cases.

Right now the documentation only has "Create and save index.html page with the following contents", but even when
you do this, and then load it into your browser, you don't see anything happening. So something is missing.

This may be super-trivial for WASM folks who already understand how this works, but for anyone new to the topic, it kind of means that you need to go to another language if you want to understand how this all works right now. Which is unfortunate, because it may be that WASM works well, but this is not shown to others how this can be done, because there is sparsely any documentation.

You can find pre-compiled wasm files on GitHub:
https://github.com/ruby/ruby.wasm/releases

The problem here is that the README at https://github.com/ruby/ruby.wasm does not really explain what one can do with this.

It seems as if this is all geared more towards advanced users.

Interestingly, I checked python + WASM, and the documentation it shows here:

https://pythondev.readthedocs.io/wasm.html

Is also very sparse.

I don't know why the WASM documentation is in general so bad.

The only exception I found so far appears to be mozilla, which actually has a very decent documentation pertaining to WASM here:

https://developer.mozilla.org/en-US/docs/WebAssembly/Using_the_JavaScript_API

So it is a bit as if one has to read these other websites first (such as the mozilla one) before being able to dive into the ruby-wasm or python-wasm aspect of it.

Actions #4

Updated by hsbt (Hiroshi SHIBATA) 8 months ago

  • Status changed from Open to Assigned
Actions

Also available in: Atom PDF

Like1
Like0Like0Like0Like0