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

[More Examples] Could more examples be added? #60

Open
rubyFeedback opened this issue Feb 1, 2022 · 1 comment
Open

[More Examples] Could more examples be added? #60

rubyFeedback opened this issue Feb 1, 2022 · 1 comment

Comments

@rubyFeedback
Copy link

Could more examples be added?

Ideally something like a slow build-up step that showcases what can be done with it.

I'd also love some example where we could add functionality to a simple sinatra
application or something like that.

Right now I am a bit clueless what we can do with wasmer. Even opal makes this
more clear than wasmer.

@kingdonb
Copy link

I think this is hard because Wasmer can do exactly what it says on the tin: it is a Wasm runtime, and that means you can do stuff like: import/export functions and memory, do basic pointer math to access strings in the memory if you have well-made functions that allow you to do that... call a function that accepts a fixed number of typed values. Execute a Wasi program.

Access a compiler! Run the compiler when you want, either just-in-time or way ahead of time. Those are all the basic features of wasmer. If we're not sure why we needed a compiler, it's going to be tricky coming up with uses for wasmer. I'd like to say that Wasm (and wasmer) have tricked me into using a compiler, I never wrote a Rust program before today, and now I'm parsing HTML in Rust, and reading files from disk, and building Cargo crates as command-line and library types.

I had some wrong ideas about how this was going to be useful to me as a Rubyist going in. I'm still not sure I've got the right idea, but I think after doing this exploration I can definitely say that I now have a much better idea of what it's not.

There's also a legitimate argument to be made, maybe, that of the languages that Wasm supports interoperability with, we probably picked the worst. I think a good example would be "how to run ruby.wasm and execute a ruby script from wasmer-ruby, in a Ruby host" because frankly that's one I couldn't get working on my own after struggling a while (invalid integer return / something not sure what the error was when fetching the Wasi version maybe I compiled it wrong)

This would give a great opportunity to talk about "where no progress is possible" – why would anyone do this? There might be some good reasons, but I'll bet you can cross performance off the list if you're running Ruby as a wasm inside of Ruby, cause no matter what you do your ruby has to be interpreted, so it's going to be slower than an actually compiled language.

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

No branches or pull requests

2 participants