Live data from Hacker News

Go gets preliminary WebAssembly support

go-review.googlesource.com

31–40 of 99 posts

Re: Go gets preliminary WebAssembly support

#31
Will the binaries be compiled for size optimization, or will they be the same size as usual golang bins?

Go binaries, being static and embedding the whole go runtime, tend to be quite big. Now, I don't care about it because 5 or 10MO on my server filesystem is nothing. If I ask every visitor to download 10MO before running my webpage, that will be a problem, though.

Is this something we will have to deal with? Or will this be a lesser featured go implementation?

Re: Go gets preliminary WebAssembly support

#32
post #22

Article mentions that the compiled code will also run on Node.js, does it mean it will be possible to use all zillions of NPM modules from Go at some point in time?

Thus solving Go's dependency management problem once and for all.

Solving it by giving it a worse one.

Re: Go gets preliminary WebAssembly support

#34

Hey so question - WebAssembly can't access the DOM right? What's the whole point then, avoid Javascript? If we can't just swap out all the gnarly JS garbage whole-hog, I don't see where the business value is, given that there's plenty of language-to-js libraries.

WebAssembly actually CAN access the DOM, but it requires some glue code.

Essentially, from the developer perspective WebAssembly is like embedding native code as a scripting language in the browser.

Only primitive data types can be passed back and forth between the foreign function interface between the two.

Re: Go gets preliminary WebAssembly support

#35

Will the binaries be compiled for size optimization, or will they be the same size as usual golang bins? Go binaries, being static and embedding the whole go runtime, tend to be quite big. Now, I don't care about it because 5 or 10MO on my server filesystem is nothing. If I ask every visitor to download 10MO before running my webpage, that will be a problem, though. Is this something we will have to deal with? Or wil…

I don't know much about wasm, but I imagine that most wasm binaries will be statically linked. The runtime does add overhead but I'd like to know how much compared to what you see with reasonably complex rust wasm code.

Re: Go gets preliminary WebAssembly support

#36
post #27

How are features like go routines and channels etc going to be supported? or they are not?

Dig a little deeper: https://docs.google.com/document/d/131vjr4DH6JFnb-blm_uRdaC0...

Mentions:

> Currently WebAssembly has no threads, but they are on the roadmap. Most Go code can run fine on a single thread. The only drawback is that “sysmon” is not available, thus there is no preemption of goroutines.

Re: Go gets preliminary WebAssembly support

#37

Could this be used to get native gRPC support for the browser?

WebAssembly doesn't provide any functional capabilities that aren't already accessible to JavaScript. This change does not really enable a browser to do anything more "natively" than it already could, other than run code that's written in Go.

And that's not really new either, due to GopherJS [1]

https://github.com/gopherjs/gopherjs

Re: Go gets preliminary WebAssembly support

#39
post #13

I really wish WebAssembly did not use the word "Assembly". It doesn't really resemble any actual assembly language. And if you look at the comments in this thread, for example, a lot of people think it's letting you have something like arbitrary machine code.

I really wish WebAssembly didn’t use the word “Web”. Its best usecase is for the server. It just happens to also be great for challenging JavaScript in the browser.

Why do you say its "best" usecase is for the server? I'm actually asking, not disputing, but I'm asking because it seems the big selling point of WASM, running new types of code that you couldn't run before, was never a problem on the server, where you can run whatever you like.

So, I'm assuming you have something else in mind, and I'm wondering what it is.

Re: Go gets preliminary WebAssembly support

#40

Hey so question - WebAssembly can't access the DOM right? What's the whole point then, avoid Javascript? If we can't just swap out all the gnarly JS garbage whole-hog, I don't see where the business value is, given that there's plenty of language-to-js libraries.

Twitch rewrote their entire video player in C++ and compiles it down to WebAssembly with Emscripten. That way the same player can be compiled to the web, as to iOS, Android, game consoles etc. That’s a huge business case when you want to create a module to support a wide variety of platforms and targets.
Post reply on HN