Even the WebAssembly authors seem to agree that it's not foremost a managed language compile target - The Overview text from http://webassembly.org/ says "Wasm is designed as a portable target for compilation of high-level languages like C/C++/Rust, enabling deployment on the web for client and server applications."
JS is a high level language. I don't see many people compiling to managed languages outside of the browser. Wonder why is that? Few target JVM...but I don't see many(if any) compiling to Java, C#, Ruby or Lua or PHP. I've never seen anyone compiling JavaScript either unless they had to run it in a browser. This should tell you how good JS is when it has to compete on merit as compiler target.
>> Also, "transpile" is just another word for "compile"
Well, I prefer to use the "transpile" term when the target is a high level language.
JavaScript is a high level language. It seems some smart folks decided that a new "language/IR" is needed (wasm) so that people can use other languages on the web. Now let's make this new IR a first class citizen on the web.
WebAssembly is a refinement of asm.js, which started as a mechnism to enable C/C++ code to run in browsers. Other, managed languages aren't forced to go the asm.js route because their semantics aren't tightly married to a byte addressable, untyped program heap.
- code size - a runtime for a managed language is much bigger if you have to reimplement & ship the primitives you get from the JS platform.
- implementation complexity: a LLVM-webassembly-toolchain along with your own GC is much harder and more work than a JS backend, and would need to have a rather good payoff to be worth investing in.
- poor cross-browser development tooling support to have a good debugging experience
- GC implementation complexity and performance - firstly, there is no GC support currently and no timeline about when/if something materalizes. The current "future GC" support in webassembly[1] doesn't provide a GC implemnetation, just hooks to peacefully coexist with JS GC.
- JS interop
- browser support
Now, it may be that some of these get solved eventually - but they would all have to be solved, with high quality solutions, to beat JS as a managed language compile target.
[1] https://github.com/WebAssembly/reference-types/blob/master/p...
I strongly disagree. Wonder why no language(managed or unmanaged languages) designer uses this gem named JavaScript as compile target?(web stuff excluded)
It seems your whole argument revolves around the fact that JS has better support than WASM in browser. We already know this. WASM is a work in progress. It's not ready yet for prime time. This year we will get some managed languages compiled to WASM. Next year we might get GC. I believe in some distant future javascript will be compiled to wasm either by the client or by the browser itself(for backward compatibility). JavaScript is JIT-ed in the browser anyway.
Really? Can you please point me to some documentation about this? I can't mange to find out how to use a wasm compiled library (compiled from C) in C#/mono project (which also compiles to wasm )
Yes, and garbage collection that crosses language boundaries.
If there are no competitors, JavaScript wins by default, just like C ffi did on server and desktop.
That said, none of this means “replacing” JavaScript, no matter what the parent says. It’s a non-goal.
I believe a better term would be "skipping" javascript than "replacing" javascript. There won't be many rewrites but I'm sure that many people would skip JS on new projects if they would have that option. Why would a Python, Go, Ruby developer choose JavaScript over Python given that their language of choice would compile to WASM(along with DOM/webAPI access)? The ecosystem may be a reason but that's only a matter of time(i.e. 1 -2 years).
Another good reason is that, regardless of what you read on Reddit and Hacker News, a lot of people actually really like JavaScript.
Yeah, that's true now though I don't think there is something that stops browsers to host a runtime(i.e. a pre-loaded std wasm library + wasm-gc) to help the languages compiled to wasm to reduce their compilation size. The question is really whether the browsers want to make WASM a first class citizen or not.
>> Another good reason is that, regardless of what you read on Reddit and Hacker News, a lot of people actually really like JavaScript.
I believe WASM could serve the other lot of people who are not that much into JavaScript. Using the same language on server and browser also reduces friction(i.e. see NodeJS). Personally I believe JS has a such rank based on reach not on merit.
> reach not on merit
Node’s popularity and success is counter to this notion, IMHO. Seriously, lots of people love JavaScript.
Regarding node it has two things going for it, the frontend devs that only know JavaScript and try to do server side as well.
The fact that thanks to its world class JITs (V8 and ChakraCore) it easily beats Python and Ruby interpreters in performance, which are the most common deployed variant.
Also the revival of Java, .NET, Flash, ActiveX is already brewing, this is not only about Python and Ruby.
Just doing games in Unity, compile to WASM and deploy, just like plain old Flash.
And while at it, use the 2D GUI to build a complete web site, just like plain old Flash.
The difference is now we can all be happy, because it is a Web standard.
And yet somehow thanks to NodeJS, javascript development seems to have gotten exponentially more complex.
The WASM will replace JavaScript argument exists not for any valid technology reasoning, because people desperately need it to (only for personal reasons) and don't understand how web technologies work on the front end.
The goal of WASM was never to replace JavaScript, but to replace Flash (before Adobe announced the death of Flash) in a language agnostic way.
What did you won with Flash being replaced?
At this time, and for the foreseeable future, there are no plans with active code in development to implement WASM as a JavaScript replacement, at least to my knowledge.
> Issues have been opened for native DOM bindings in WASM, but I am not sure if that work ever started.
I didn't say work had started on it. I just said that it is planned. See here for proof: http://webassembly.org/docs/high-level-goals/
> access browser functionality through the same Web APIs that are accessible to JavaScript
By passing data.
So what would a DOM API exposed to WASM look like? COM is the only example that comes to mind.
These two things aren't contradictory. wasm is typed.
Let's hope exactly the other way around will happen. I would rather like to see better interop between different languages using wasm than wasm + js.