[HN Gopher] Wasmer takes WebAssembly libraries mainstream with WAI
       ___________________________________________________________________
        
       Wasmer takes WebAssembly libraries mainstream with WAI
        
       Author : the_duke
       Score  : 67 points
       Date   : 2022-12-02 17:42 UTC (5 hours ago)
        
 (HTM) web link (wasmer.io)
 (TXT) w3m dump (wasmer.io)
        
       | qclibre22 wrote:
       | I'm getting content blocked at work:
       | 
       | Content blocked by [redacted]
       | 
       | Reason: This Category is filtered: grayware
       | 
       | Are there security concerns with wasmer.io ?
        
         | syrusakbary wrote:
         | Hey, Syrus here from Wasmer. This is the first time I'm hearing
         | from this. No, there shouldn't be any security concerns in our
         | website (it's actually fully open source as well [1], if you
         | want to take a look)
         | 
         | Do you happen to know what firewall does your work use? I'd
         | love to follow up with them to make sure this is resolved asap
         | 
         | [1]: https://github.com/wasmerio/wasmer.io
        
           | qclibre22 wrote:
           | Not sure what's up. No idea what the local filter software
           | is. I'll fill out the local complaint form. wasm files are
           | being served up from github.io , so wasm files, per se, are
           | not the problem.
        
             | benatkin wrote:
             | Behind every overly aggressive filter is an allowlist.
             | GitHub would likely be the first addition.
        
           | flohofwoe wrote:
           | I remember that a couple of years ago any wasm file hosted on
           | any github page would be blocked by the EasyPrivacy list
           | (apparently some idiots used github pages to host coin
           | miners). Maybe it's a similar over-eager blocking rule.
        
       | dlojudice wrote:
       | would it be possible, for example, to access the standard decimal
       | library of C# or Python via Javascript, thus not having to wait
       | for the TC39 spec / implementation? [1]
       | 
       | [1] https://github.com/tc39/proposal-decimal
        
         | syrusakbary wrote:
         | Decimal values are not currently represented as a first-class
         | type by WAI (as int, floats or string types are) but I believe
         | it would be a great idea to do so.
         | 
         | Would you mind opening an issue in the WAI repository [1] so we
         | can follow up there? Thanks!
         | 
         | [1] https://github.com/wasmerio/wai
        
           | duped wrote:
           | Would this come under the WASI component model?
        
         | the_duke wrote:
         | The code you want to use has to compile to Webassembly.
         | 
         | This is in fact possible for C# and Python, but especially in
         | the browser you would want to have a small binary size, and
         | avoid bringing along the whole runtime of these managed
         | languages if all you want is a small functionality subset.
         | 
         | A very viable solution would be creating a decimal package with
         | either a native Rust crate (I think there are a few decimal
         | implementations) or with one of the goto C libraries.
         | 
         | That would be much smaller and faster as well.
        
       | singularity2001 wrote:
       | wasmer add --pip wai/tutorial-01 Querying WAPM for package
       | bindings error: Unable to find bindings for
       | wai/tutorial-01@latest +-> 1: The package doesn't contain any
       | bindings
       | 
       | I guess one needs to publish a pip package? pip has very high
       | requirements to publishing packages. the wai tutorial gives zero
       | info on how to create a local pip package.
        
         | syrusakbary wrote:
         | Looking into it. The command you posted should work:
         | wasmer add --pip wai/tutorial-01
         | 
         | Will post as soon as we get it fixed. Thanks for letting us
         | know
         | 
         | EDIT: (+25 min) The command should be fully working now
        
           | singularity2001 wrote:
           | almost. the command works but the import fails:
           | 
           | /opt/wasm/wai/tutorial-01/ python3 consume.py Traceback (most
           | recent call last): File
           | "/opt/wasm/wai/tutorial-01/consume.py", line 2, in <module>
           | from tutorial_01 import bindings File
           | "/opt/homebrew/lib/python3.10/site-
           | packages/tutorial_01/__init__.py", line 7, in <module> from
           | wasmer import Store as _Store # type: ignore File
           | "/opt/homebrew/lib/python3.10/site-
           | packages/wasmer/__init__.py", line 1, in <module> raise
           | ImportError("Wasmer is not available on this system")
           | ImportError: Wasmer is not available on this system
           | 
           | which wasmer /opt/homebrew/bin/wasmer
           | 
           | wasmer -v wasmer 3.0.2
        
             | syrusakbary wrote:
             | Almost there! Are you in macOS m1/m2 by any chance?
        
       | RcouF1uZ4gsC wrote:
       | Between WebAssembly, Cloudflare Durable Objects/Workers are the
       | equivalents from Fly.io, it seems we are finally recreating the
       | features of IBM System/360 mainframe from 50 years ago, in terms
       | of portable code that could run reliably and scalably even with
       | faulty hardware. WebAssembly is the modern 360 Assembler that
       | allows you to compile once and run anywhere. (Kubernetes is the
       | modern JCL)
        
       | EMM_386 wrote:
       | I've been a developer for decades and I'm still getting highly
       | confused by all of this WASM, Wasmer, WasmEdge, Wasmtime, etc.
       | 
       | There was another one on the front page today that allowed you to
       | use WASM to program other programming languages ("Extism: make
       | all software programmable").
       | 
       | Where are we headed with all of this?
       | 
       | I can see a future where WASM supports GC-languages, then you
       | esentially have things like C# or Java desktop applications
       | running "in the browser" via WASM? Doesn't that throw all of
       | HTML, CSS, etc out the window?
       | 
       | Honest question, sorry if it's dumb. But all these WASM terms,
       | releases, etc. have me completely lost. I'll stick to my day job.
        
         | syrusakbary wrote:
         | Extism is great [1], and I have great admiration for what they
         | are doing. We didn't know they were working on that, if that
         | was the case perhaps we the need for WebAssembly Interfaces
         | ("WAI") would have been minimized.
         | 
         | In any case, it seems that there will be multiple ways of
         | generating bindings going on in the future. And you will
         | probably need to pick the option will fit better your needs!
         | (similarly as how you can use Protocol Buffers, Cap'N'Proto or
         | Thrift).
         | 
         | [1]: https://extism.org/
         | 
         | > But all these WASM terms, releases, etc. have me completely
         | lost.
         | 
         | I don't blame you, I work on this and even for me it's a bit
         | hard to keep up. Hopefully things will improve and become more
         | clear over time!
        
         | dvt wrote:
         | > Where are we headed with all of this?
         | 
         | We are heading nowhere.
         | 
         | Hot take: WASM is a dead technology and has failed to displace
         | vanilla JS. There are only a few very niche use cases, most of
         | which have zero product-market fit (e.g., no one wants to play
         | video games in a browser).
         | 
         | Furthermore, no one wants to seriously write C++/Rust/Java and
         | then compile it to WASM. These days, WASM projects are a neat
         | way to pad your resume or get tech "thought leaders" to tweet
         | about you. As far as Extism goes, it sounds like a problem
         | looking for a solution. We already have LUA and JS as
         | embeddable scripting languages, so here we go overengineering
         | yet again.
        
           | galangalalgol wrote:
           | App developers wanted it to work. And if apple had allowed it
           | to work in safari like it does on android, it might have made
           | progress.
        
         | traverseda wrote:
         | >Where are we headed with all of this?
         | 
         | https://www.destroyallsoftware.com/talks/the-birth-and-death...
        
         | mysterydip wrote:
         | Not dumb, I feel the same way. I need a good WASM primer: what
         | are they all, how do you use them, what interfaces (or doesn't)
         | with them, etc.
        
           | traverseda wrote:
           | You can compile software to WASM using emscripten. When you
           | see a video game that runs in a web browser it was probably
           | done via emscripten and wasm. When you see old DOS games on
           | archive.org those are done by compiling dosbox to the
           | browser. Emscripten includes some shims for pretending you
           | have a file system and a clock and all that stuff.
           | 
           | There are also GC'd languages ported to WASM, things like
           | Pyodide, but they're pretty big and have some rough edges as
           | they're not normally allowed to do things like make network
           | calls.
           | 
           | WASM is just a virtual machine, sort of like the JVM, but
           | that runs in the browser. It might help to think of WASM
           | (Web-ASseMbly) as a new CPU architecture. It's a minimal CPU
           | instruction set (a virtual instruction set) that can be
           | relatively easily jitted or transpiled into machine code.
           | 
           | WASM by itself doesn't do anything, the specs for what kind
           | of interfaces exist between the WASM sandbox and the host app
           | are still sort of in the air. It's soft of like saying "what
           | can I do with a RISC-V CPU". The answer is "not much until we
           | make more infrastructure that supports it.
           | 
           | Right now you can port large C code bases over to run in a
           | browser with emscripten so that's nice. Maybe you'll write a
           | web component using WASM at some point.
        
             | mysterydip wrote:
             | Thank you for the explanation! Time to read up on
             | emscripten.
        
             | EMM_386 wrote:
             | > Right now you can port large C code bases over to run in
             | a browser with emscripten so that's nice. Maybe you'll
             | write a web component using WASM at some point.
             | 
             | But doesn't this have the potential for a massive, paradigm
             | shift in how we look at the "web"?
             | 
             | Take just one example, a GC language like C# or Java being
             | able to run under WASM (inside a web browser?).
             | 
             | It could bypass HTML, CSS, and JS entirely and just run as
             | if it were a desktop application.
             | 
             | Doesn't this lead us down the rabbit hole back to Java
             | applets, Flash plugins and other similar plugins, albeit
             | more secure/sandboxed?
             | 
             | If every website is free to render a button using any
             | programming language it wants, there is no longer any
             | standardization, accessibility features, a layout engine,
             | etc.
             | 
             | What is the point of a "web browser" at all, if all it does
             | is host a WASM-based application?
             | 
             | I think that's the part where my brain starts to give up.
        
         | jayd16 wrote:
         | I might be wrong but I think you can conceptualize like this...
         | 
         | Wasm is essentially a target bytecode and runtime based on the
         | well tread security model of javascript in the browser.
         | 
         | Browsers can run it, languages can compile to it, apps of any
         | language can host a runtime that runs it. This leads to
         | infinite permutations and nesting of concepts.
         | 
         | Because its web tech there's a dozen ways to do the same thing.
        
         | miohtama wrote:
         | > Where are we headed with all of this?
         | 
         | To the future where Silicon Valley funded startups try to find
         | angles to extract value from WASM. A lot of competing efforts
         | with different business models.
         | 
         | Hopefully in the end we get good VC funded open source and can
         | discard any too aggressive monetisation attempts.
        
       | benatkin wrote:
       | Uh oh, they still don't seem to have fully relinquished their
       | claims to the name "WebAssembly". Their vscode package is listed
       | under "WebAssembly Foundation".
       | 
       | https://marketplace.visualstudio.com/publishers/dtsvet
        
         | syrusakbary wrote:
         | It's been this way for a little bit already (actually since 3
         | years ago! [1]).
         | 
         | It was an intentional thing though, because we want to put this
         | extension under a common group, not something that only Wasmer
         | owns... that's why we haven't changed it yet. But I agree that
         | probably using WebAssembly Foundation is perhaps not the best
         | name :)
         | 
         | [1]: https://github.com/wasmerio/vscode-
         | wasm/commit/0f7f00f44aa72...
        
           | benatkin wrote:
           | WebAssembly Foundation is a misleading name. WebAssembly has
           | a foundation, just not a separate one. It's W3C.
           | 
           | https://en.wikipedia.org/wiki/WebAssembly
           | 
           | I like that OpenJS Foundation is called OpenJS Foundation and
           | not JS Foundation.
           | 
           | That said, the main thing I object to is the trademark.
        
             | syrusakbary wrote:
             | You actually gave me a great idea! Perhaps we can rename it
             | to OpenWasm Foundation (I think that's a great name, your
             | suggestion inspired me). I will discuss with more people to
             | see what name will make more sense to rename it to.
             | 
             | And please let me know if you have other suggestions!
        
               | benatkin wrote:
               | Good luck. I wouldn't mind having multiple organizations.
               | The Bytecode Alliance is great but I would rather people
               | recognize that WebAssembly belongs to the W3C (or
               | everyone via the W3C if you prefer to think of it that
               | way) and not them or the CNCF.
        
               | syrusakbary wrote:
               | > I would rather people recognize that WebAssembly
               | belongs to the W3C (or everyone via the W3C if you prefer
               | to think of it that way) and not them
               | 
               | I 300% agree with you on this
        
       | themgt wrote:
       | Interesting little discussion linked about this fork of WAI from
       | wit-bindgen:
       | 
       | https://github.com/bytecodealliance/wit-bindgen/issues/306
        
         | hardwaresofton wrote:
         | Interesting, sounds like the. Kubernetes in tree vs out of tree
         | + CSI situation.
         | 
         | In the end the real solution was this:
         | 
         | > All host generators are being removed from this repository
         | for example here and here. The JS generator will eventually
         | move to its own repository as well, just takes time.
         | 
         | Should have been what they did from the start. Thread was
         | informative with regards to understanding where the rifts in
         | the community are and how people think though.
        
       | laerus wrote:
       | Ah it's these guys that tried and still try to hijack the glory
       | of webassembly just for their startup to succeed. Wasmer is
       | doomed to fail cause it's leadership smells fishy.
       | 
       | Btw a packaging solution has already started to be designed by
       | the people that actually care about the wasm ecosystem, so it's
       | not going to be wapm.
        
         | syrusakbary wrote:
         | Hi, I'm Syrus from Wasmer. I usually try not to get drawn into
         | hate comments that don't add any value, but I'll make an
         | exception today as it's sunny here in San Francisco!
         | 
         | We care deeply about the Wasm ecosystem. In fact, we care so
         | much that we are wary of putting it at mercy of the big tech.
         | Wasm is a beautiful community that should embrace many points
         | of view, starting from the Web and permeating back to the
         | servers.
         | 
         | I think is a strength to collaborate, to let developers with
         | different points of view discuss without forcing one unique
         | point of view on all. Unfortunately it will not be a surprise
         | for some to learn that certain players on the industry want to
         | force their unique perspective on the rest, where only "one
         | way" is the right way of doing things. I'm betting my horses (I
         | have two parked in the hallway), that the packaging initiative
         | that you are talking about comes from these groups.
         | 
         | Thankfully, Wasmer is probably one of the few companies with
         | great context on how to do a Package Manager in WebAssembly (we
         | started it 3 years ago, and got tons of learnings since then!),
         | so just trying to replicate without collaboration seems like a
         | big mistake (best of luck to them there!).
         | 
         | In any case, I'm not the only person that feels this way and I
         | know this feeling is shared by big part of the Wasm community.
         | 
         | I wrote a bit more about this here as well:
         | https://news.ycombinator.com/item?id=33805585
        
         | remram wrote:
         | > hijack the glory of webassembly just for their startup to
         | succeed
         | 
         | What do you mean by that? What are they doing, apart from
         | existing as a company in the webassembly ecosystem?
        
       | klabb3 wrote:
       | One of the most exciting aspects of wasm is a safer and more
       | expressive API surface for universal FFI. Currently, the lowest
       | common denominator is the C ABI. In the future, it could be wasm.
       | 
       | Obviously wasm can be much more, but just that alone can be
       | really useful.
       | 
       | * No custom language-A to language-B bindings necessary, only 1
       | wasm binding per lang. That's O(N) bindings in total, instead of
       | O(N^2), which isn't feasible and that's why we don't have Julia-
       | intercal or PHP-Java today (or maybe we do?)
        
         | kllrnohj wrote:
         | WASM is entirely unrelated to that issue. If you want to
         | "solve" cross-language interop & ABI surfaces, you want
         | something like COM.
        
           | duped wrote:
           | That's exactly what the component model defines, but it looks
           | to be more useful than COM or CORBA.
           | 
           | https://github.com/WebAssembly/component-
           | model/blob/main/des...
        
         | panic wrote:
         | How would (e.g.) strings work in this FFI, considering that
         | wasm doesn't have a built-in string type or any way to pass
         | variable-length data to a function without allocating space for
         | it in the instance's memory, and languages have different
         | native string representations (UTF-8 vs UTF-16 vs "UTF-16")?
        
           | jayd16 wrote:
           | No one said it would be cheap or allocation free.
        
         | beached_whale wrote:
         | I did a test of an ALU/BP(non-vecorized JSON deserialization)
         | heavy library last year and the price of Wasmer/wasm was only
         | about 20-25%. For many things, that's not going to even be
         | noticed.
        
         | ilaksh wrote:
         | What I want is to be able to call another web assembly library
         | from inside of one.
        
       ___________________________________________________________________
       (page generated 2022-12-02 23:00 UTC)