1. 46

This has been sitting in drafts for months. I decided to just go ahead and polish and publish it.

I’m interested to hear where and how wasm is being used in the real world. Does anyone use it at work? Are there any places you’ve been able to see value in pushing for it? Thanks bye.

  1. 9

    Have you checked out wasmer yet? I think it will come in quite handy.

    Also, I do quite a bit with WebAssembly. In fact, I’ve been using emscripten since before there even was WASM. Check out genact for a useless project I did that outputs to WASM as well as native platforms.

    1. 1

      I have not seen that, thanks for the link, I will check it out!

    2. 4

      FWIW this is one of the examples that made me “get” WebAssembly:


      It’s an implementation of /bin/echo, and is pretty readable if you stare at it for awhile.

      • It “imports” _fwrite and _stdout from the environment. By default WASM is sandboxed, so it can only do I/O on injected “objects”.
      • It exports main() for the wrapper to call (in this case, the command line, but more often the browser)
      • It defines a strlen() function that does the obvious thing – loop over the characters until you get to NUL.
      • it defines an fputs function that calls strlen() and _fwrite()
      • The main program loops over the argv array and returns an integer status 0
      • The keywords are mostly self explanatory:
        • module, func, return
        • import, export
        • local, set_local
        • if, loop
        • data appears to be for global constants
        • drop ignores a return value (since WASM is a stack machine I suppose)

      It’s very verbose! But everything is pretty explicit which makes it readable for small examples like this. There are other examples in the same dir:


      The WebAssembly paper explained enough of the conceptual model, which made this example fairly readable:

      Bringing the web up to speed with WebAssembly

      1. 1

        Hey thanks for these resources, I will look them over!

        I think my next post will be about making minimum versions of all the sections the spec outlines and then trying to do something useful with them, so the echo example is a very good one.

      2. 2

        I have kept my distance from WebAssembly for the past few years. Your article has piqued my interest in it again; going to take a closer look now.

        1. 2

          I understand the distance, its elevator pitch is somehow both really compelling and also kind of superfluous at the same time. I’m really interested to see how it evolves long term though, and it being standardized and shipped in all relevant contexts is a big positive signal for that long term.

        2. 2

          Nice write up and interesting to see your e2e round tripping tool chain. Is this something you came up with? And is this a way to develop/debug?

          1. 1

            If you mean wasm2wat and wat2wasm, they are part of wabt (web assembly binary toolkit) which I link to in the post. If you mean the xxd parts, that’s definitely useful in viewing binary files as visually understandable text without transforming it at all. Thanks for reading!