News for hackers. Stuff that matters.
Re:Web Assembly and Go: A look to the future by pjmlp on Saturday June 23, 2018 @12:31PM (#17381987)
That is the only way Web will ever catch up with native, by becoming itself yet another generic purpose VM platform.

In the process it will be the revenge of plugins.

Re:Web Assembly and Go: A look to the future by TekMol on Saturday June 23, 2018 @12:35PM (#17382003)
The web already is 'generic purpose'. Outputting JS or WA does not make any difference in that regard. It just makes things a bit faster.
Re:Web Assembly and Go: A look to the future by derefr on Saturday June 23, 2018 @12:49PM (#17382076)
Sure, the web is sometimes used that way currently, but few projects are using full-on Foo-to-JS compilers like GWT or ClojureScript that make the original source entirely illegible when viewed through the browser console.

Instead, projects are mostly using "light" transpilers built to have clean mappings to JS semantics, like TypeScript, where the original source can be recovered and traced by the browser as long as the transpiler generates a source-map.

WASM really won't work with the "source map" paradigm, and so a move to a web where most development uses languages that compile to WASM, is a move to a more opaque, less learnable web. (And also one that browser extensions have far less of an ability to intercede in.)

Re:Web Assembly and Go: A look to the future by eklitzke on Sunday June 24, 2018 @01:48AM (#17385142)
This just means you won't debug things using a browser console, but using a debugger designed for the host language instead. And that would be a blessing: I'm far more proficient in GDB than I am in the Chrome/Firefox developer tools.
Re:Web Assembly and Go: A look to the future by Felz on Saturday June 23, 2018 @04:34PM (#17383301)
Why won't WASM really work with the "source map paradigm"? Is there something fundamentally different about bytecode that means it cannot be traced back to its original source, given tooling support?
Re:Web Assembly and Go: A look to the future by slimsag on Saturday June 23, 2018 @08:52PM (#17384348)
WASM will have source map support, if it does not already. There is already support on Firefox nightly it seems: https://github.com/yurydelendik/wasm-source-map-emscripten
Re:Web Assembly and Go: A look to the future by kreetx on Saturday June 23, 2018 @02:57PM (#17382775)
But there's an upside, no? There is no way to reference an undefined variable in go? So if the compiler is correct, so will be the result, and errors would be found compile time.

(written by a non-go-expert)

Re:Web Assembly and Go: A look to the future by ovao on Monday June 25, 2018 @12:12AM (#17389843)
While you cannot reference an undefined variable in Go, you can still dereference nil pointers and invoke other operations that result in a panic (some of the standard library functions can panic).
Re:Web Assembly and Go: A look to the future by erikpukinskis on Saturday June 23, 2018 @12:45PM (#17382046)
It’s not necessarily any faster. You can shoot yourself in the foot quite easily too, performance wise.
Re:Web Assembly and Go: A look to the future by mankash666 on Saturday June 23, 2018 @01:51PM (#17382394)
It's more predictable, when generated from a strongly typed language.

Most of the times, due to the strong typing, it is faster. However, there's a cost involved in compiling, invoking and passing data in and out of a wasm module. If the overhead cost is greater than the raw performance gain, there's no discernable difference

Re:Web Assembly and Go: A look to the future by uluyol on Saturday June 23, 2018 @02:00PM (#17382448)
Don't forget about crossing language boundaries. Using JNI can be slower than pure Java code, and I think the same is true for wasm-js interop [1]. When wasm gets "native" access to the DOM and other browser features this may change, but until then, DOM manipulation is probably going to be faster in js.

[1] someone should benchmark this.

Re:Web Assembly and Go: A look to the future by johncolanduoni on Saturday June 23, 2018 @05:59PM (#17383683)
JNI transitions (at least on OpenJDK and Android) are much more expensive that WebAssembly<->JavaScript transitions. For the latter the same JIT is being used on both sides and there is no need for a GC transition. JNI is also far from as fast as it could be; .NET’s PInvoke is much more efficient (and easier to use).
Re:Web Assembly and Go: A look to the future by pjmlp on Sunday June 24, 2018 @02:45AM (#17385328)
Mark Reinhold already stated on a few talks, including at JavaONE that Sun designed it that way on purpose as they wanted to keep everyone true to WORA without carrying native code around.

Which is also a reason why a replacement is being done as part of Project Panama, initially advocated by Charles Nutter due to the JRuby project issues.

http://openjdk.java.net/jeps/191

In alternative, if you have the source code available there is a way not to any transitions.

Java now has GraalVM and .NET had C++/CLI (nee Managed C++) since the beginning.

Re:Web Assembly and Go: A look to the future by rubber_duck on Saturday June 23, 2018 @12:49PM (#17382070)
In this version of web assembly only !

Web Assembly is gimped because it needs to be compatible with existing JS runtimes - when they add threading support you will no longer be able to run a WASM shim in JS but at the same time WASM will become a lot more general purpose.

Re:Web Assembly and Go: A look to the future by johncolanduoni on Saturday June 23, 2018 @06:01PM (#17383688)
Existing JS runtimes actually use shared-memory concurrency a ton, even ignoring the (currently disabled) SharedArrayBuffer. Code generation and garbage collection have at least some concurrent stages on all the major JS engines. JavaScriptCore even exposes this in its API.
Re:Web Assembly and Go: A look to the future by TekMol on Saturday June 23, 2018 @12:52PM (#17382085)
Javascript already has multithreading via webworkers. That's not something WASM will introduce.
Re:Web Assembly and Go: A look to the future by rubber_duck on Saturday June 23, 2018 @01:02PM (#17382156)
SharedArrayBuffer is only available in chrome and FF and they disable it by default so no way to do standard multithreading via webworkers.
Re:Web Assembly and Go: A look to the future by TekMol on Saturday June 23, 2018 @01:15PM (#17382218)
It was disabled because of spectre.

Multithreaded WASM isn't here either.

I think WASM will face the same security considerations.

Re:Web Assembly and Go: A look to the future by untog on Saturday June 23, 2018 @02:39PM (#17382689)
Webworkers are multithreading. You just have to use slower, async communication methods. WASM will likely be the same way, given the security considerations.
Re:Web Assembly and Go: A look to the future by pjmlp on Saturday June 23, 2018 @03:21PM (#17382896)
Re:Web Assembly and Go: A look to the future by skybrian on Saturday June 23, 2018 @01:54PM (#17382413)
By itself, adding the Go SDK to the mix is unlikely to simplify the toolchain. To do that, you need to remove more complexity than you add.

There might be a chance to simplify if you're already using Go on the server and you remove a lot of other stuff.

Re:Web Assembly and Go: A look to the future by chiefalchemist on Saturday June 23, 2018 @12:59PM (#17382138)
But if catching up means taking on baggage and complexity, is that still a win. Technology is a means, not an ends. Of course non-native should evolve, but taking a copy-cat approach seems like a not so good plan.
Re:Web Assembly and Go: A look to the future by solarkraft on Saturday June 23, 2018 @02:34PM (#17382659)
Luckily the "plugins" will be bundled with the apps. The trade-off is ever-increasing download sizes.
Re:Web Assembly and Go: A look to the future by pjmlp on Saturday June 23, 2018 @03:22PM (#17382906)
In the age of using JavaScript to render text.