
Show HN: Wasmer – A Go library for executing WebAssembly binaries - syrusakbary
https://github.com/wasmerio/go-ext-wasm
======
jedisct1
WebAssembly is still being designed as we speak, but I love how Wasmer has
been the "less talk more action" actor since the beginning.

That being said, and while it's cool to be able to run WebAssembly code from
PHP, Ruby, Python or Go, I'd love to hear about some actual use case for this.

Being able to reuse code across multiple languages is nice, but that's already
doable, and usually easier and faster, by building a shared library and using
a FFI interface.

Is it only about the debatable security of WebAssembly's linear memory model?

~~~
mbzi
> "I'd love to hear about some actual use case for this"

I use WebAssembly for non security critical but fun in browser Augmented
Reality experiences. We have an ever improving 10 year old fully tested C++
SDK which has bindings to iOS, Android, Windows (DLL, Electron forms), and
macOS. We use Emscripten to transpile our code to ASM.JS and WebAssembly for
the JavaScript in browser version.

From a company perspective it is great to reuse well tested code on another
platform without investing time rewriting it.

From a developer perspective it allows my R&D engineers to write what they
love in the language of their choice. Not fighting a new language each time.

From a user perspective the speed of WASM is significantly faster than pure JS
and even ASM.js. This increases the experience frame rate from ~30 to 60+.

So all in all I am a huge fan of WebAssembly experiences. The only major
problem encountered was when Spectre / Meltdown appeared we had issues around
SharedArrayBuffer which resulted in temporarily moving clients from WASM to
ASM.JS, but we have found solutions for this since.

~~~
jedisct1
Sure, but this is off-topic.

My question was about why one would want to call WebAssembly functions from Go
or PHP.

~~~
8lall0
You can use wasm as a lingua franca between languages if you have some good
libraries or programs that you want to share.

~~~
jedisct1
Like... a shared library?

I have a single libmysql.so file installed on my system, and it's used by
Python, Ruby, C and PHP.

Why should I replace libmysql.so with libmysql.wasm?

~~~
chownie
Because libmysql.wasm runs on any platform whereas libmysql.so has to be
replaced with libmysql.dll on windows.

~~~
pjmlp
Just like libmysql.dll, that libmysql.wasm will only run on Windows, if there
is a Windows application that knows what to do with it.

~~~
asdkhadsj
Yea, that's generally how code works - no?

This is simply an abstraction "everyone" has agreed on. Conceptually no
different than if everyone had agreed on Java, or Python, or Brainfuck.

~~~
pjmlp
Exactly, and neither the first not the last at it.

~~~
asdkhadsj
But that's not a bad thing. To me it appears better than previous attempts, I
heavily look forward to it.

The HN drama around WASM and cries of the days of Java always leave me
perplexed. Makes me wish Java didn't suck so bad so these convos could end
haha.

~~~
pjmlp
All previous attempts, starting all way the back to UNCOL in 1958?

WASM only exists due to political reasons of Mozilla not embracing PNaCL.

If Chrome already had the current market share back then, we wouldn't be
seeing such adoration, as if no one ever done it before.

~~~
asdkhadsj
And if Java managed to get a hold we'd be asking why this is better than Java
_(which doesn 't exist with these features in this manner)_.

That's the point. It's seemingly good, and available. Why the pushback? I
don't get your _(or anyones)_ objections.

> If Chrome already had the current market share back then, we wouldn't be
> seeing such adoration, as if no one ever done it before.

I think you misunderstand the adoration. It's not as if this has never been
done before. It's that this isn't done now. What else can I use? Nothing. I
remember 10 years ago dying for a way to run Python in the browser and having
no reasonable options for general web.

Even now, what _other_ option do I have? ASM.js is the only thing that comes
to mind, which has significant downsides.

It feels like the dislike/complaints are pointed in the wrong direction. If
you're upset that this isn't Java _(not that you are)_ , complain about why
Java can't be used right now like WASM can. Complain that Java didn't manage
to hold favor 10 years ago.

~~~
pjmlp
I complain about the adoration, like WASM was some kind of gift from God and
everyone else that came before never existed.

10 years ago there were ways run Python in the browser. ActiveState used to
have such plugin for example.

Why do you think there is a _language_ attribute on the _< script>_ tag?

And for some strange reason, the same ones that adore WASM, seem to only be
aware of Java as bytecode format and nothing else.

~~~
asdkhadsj
> 10 years ago there were ways run Python in the browser. ActiveState used to
> have such plugin for example.

I didn't say it was impossible, but it's a massive stretch to compare WASM now
and some hack that worked if you had the right plugins installed. Common dude,
that's just disingenuous.

 _edit_ : To think of it differently, I'm able to compile any language to run
on any modern browser _(which is most these days)_. I can even do it at my
work, since we support Chrome. This was never possible before. I waited for
_years_ to run Python in browser without hacks or trickery. You're thinking I
just oopses, missed that this was all possible before?

Sigh.

------
skybrian
This seems a bit confusing since "Wasmer" is also the name of the umbrella
project.

~~~
peter998
Thanks for the ping! We decided to use the same name (Wasmer) for the language
embeddings as for the standalone runtime as we thought it could be easier for
people to find related resources for the runtime. Hopefully is not too
confusing! :)

~~~
skybrian
The more usual solution would be to use a longer name containing "Wasmer". So,
"Wasmer Go Library" or "Wasmer for Go" or something like that.

------
kstenerud
Very cool! Could you add "native" to the benchmark so that we get a better
idea of the scale?

