Live data from Hacker News

Intro to WebAssembly

codelitt.com

1–10 of 48 posts

Re: Intro to WebAssembly

#3
The official FAQ specifically states the opposite of the second bullet point.

Web Assembly is not meant to be a replacement for JavaScript. And although the blog doesn't explicitly say it, it's alluding to it being easy to create entire applications without using JavaScript at all.

JavaScript is going to continue to be used as "glue code" at the very least, and UI code in the majority of cases. I think it's really important to make this distinction.

Trying to use web assembly as a solution to problems it's explicitly not meant to solve is only going to lead to pain and frustration.

Furthermore, things like "static type checking", easy functional programming, and making application coding "less painful" aren't really goals as the post seems to make them out to be as well.

Re: Intro to WebAssembly

#4
I like the idea of WebAssembly too; it is another kind of VM code. However, is there a C API to WebAssembly? Having a JavaScript API that is usable in both HTML and Node.js (and could easily be added to any other JavaScript too) is good, but a C API can also help (and I have written on some file on my computer what are some ideas for making a C API).

(I did not read the linked document much though, but only the official FAQ. However I do think you would not use WebAssembly all the time, but it can be helpful in some cases, including wanting VM codes.)

Re: Intro to WebAssembly

#6

I like the idea of WebAssembly too; it is another kind of VM code. However, is there a C API to WebAssembly? Having a JavaScript API that is usable in both HTML and Node.js (and could easily be added to any other JavaScript too) is good, but a C API can also help (and I have written on some file on my computer what are some ideas for making a C API). (I did not read the linked document much though, but only the offic…

DOM manipulation isn't currently supported, for now you will need to provide a javascript layer between the C code and DOM. Its in the roadmap to create these interfaces.

Web assembly is better suited for CPU intensive tasks which you would want to offload from javascript but keep on the client.

Re: Intro to WebAssembly

#7
post #3

The official FAQ specifically states the opposite of the second bullet point. Web Assembly is not meant to be a replacement for JavaScript. And although the blog doesn't explicitly say it, it's alluding to it being easy to create entire applications without using JavaScript at all. JavaScript is going to continue to be used as "glue code" at the very least, and UI code in the majority of cases. I think it's really im…

the roadmap for WebAssembly does include interfaces into DOM manipulation, it's not the highest priority but allowing javascript replacement isn't completely out of the scope of web assembly. Just don't expect it to be a good idea for quite some time.

Re: Intro to WebAssembly

#8
I'm really surprised to read an article like this that doesn't mention Rust. The reason is that I find it hard to believe that developers will want to move to unsafe languages like C/C++. Many of the other languages mentioned require runtimes, runtimes that will need to be built on top of webassembly.

Rust doesn't have any of these drawbacks, is runtime free, and can already target webassembly. Given that both of these technologies are young, webassembly even younger, there's no big argument for legacy code in this context, which means adopting something new would be fine, and good in this case because of the safety guarantees.

Anyway, a great intro in general, but for anyone looking at getting into this, I highly recommend checking out the Rust tutorials, like this one: https://medium.com/@ianjsikes/get-started-with-rust-webassem...

Re: Intro to WebAssembly

#9
post #3

The official FAQ specifically states the opposite of the second bullet point. Web Assembly is not meant to be a replacement for JavaScript. And although the blog doesn't explicitly say it, it's alluding to it being easy to create entire applications without using JavaScript at all. JavaScript is going to continue to be used as "glue code" at the very least, and UI code in the majority of cases. I think it's really im…

> Web Assembly is not meant to be a replacement for JavaScript.

This seems like a very short sighted view. It's meant to offer options other than JavaScript. For many of us who dislike JS, this is exactly what webassembly represents, a way to deploy applications without JavaScript to the browser, in effect finally achieving the full dream of the JVM.

And yes, DOM integration isn't there right now, but it will be. It makes sense to me that this is initially being limited for a number of reasons. It definitely means people won't immediately glob onto it, reducing the potential of accidentally locking in implementation bugs/features.

Some people think the DOM is unnecessary even in a webassembly world, but I think CSS and the DOM are generally good, what I've always wanted is a better language option.

I'm practically giddy with the potential for all of this finally happening!

Re: Intro to WebAssembly

#10

I like the idea of WebAssembly too; it is another kind of VM code. However, is there a C API to WebAssembly? Having a JavaScript API that is usable in both HTML and Node.js (and could easily be added to any other JavaScript too) is good, but a C API can also help (and I have written on some file on my computer what are some ideas for making a C API). (I did not read the linked document much though, but only the offic…

It's like asking "is there JavaScript API to JavaScript".

WebAssembly is a portable instruction set, a simplified CPU.

The main use case for WebAssembly is compiling C/C++ code to that instruction set using emsscripten, which is a clang-based C/C++ compiler that emits WebAssembly modules.

Depending on how you look at it, the answer to "is there C API to assembly?" is:

a) yes, that's the first API there ever was and it's the main API

b) the question doesn't make sense. C/C++ is compiled to WebAssembly, there's no API to it. You could imagine a system that would allow using WebAssembly modules from native C/C++ code, where you would need a C/C++ bridge to executing WebAssembly functions (similar to JavaScript bridge for calling WebAssembly functions), but this is not really why WebAssembly exists

Post reply on HN