
What is WebAssembly? (2015) - VeilEm
https://medium.com/javascript-scene/what-is-webassembly-the-dawn-of-a-new-era-61256ec5a8f6
======
castell
What's the difference between asm.js and WebAssembly?

"The initial implementation of WebAssembly support in browsers will be based
on asm.js and PNaCl". PNaCl?
[https://en.wikipedia.org/wiki/WebAssembly](https://en.wikipedia.org/wiki/WebAssembly)
, [https://en.wikipedia.org/wiki/Asm.js](https://en.wikipedia.org/wiki/Asm.js)

So is WebAssembly mere an asm.js v2 where all browser vendors agreed on a
standard?

~~~
antome
More specifically, asm.js can be seen as WebAssembly alpha, and will exist as
a shiv until most browsers can run WebAssembly. Both WebAssembly and asm.js
can be compiled through emscripten.

------
jacobolus
Note, this is from last June. It was submitted a few times, but apparently
only one had a comment:
[https://news.ycombinator.com/item?id=9742556](https://news.ycombinator.com/item?id=9742556)

------
jlebrech
I just want a web framework that works like QT or GTK, or even a framework as
a desktop that can be styled/themed independently of function.

WebAssembly should give us opportunity for this.

~~~
moron4hire
No, that's not really what it's about. Perhaps you're think of something more
like NW.js or Electron.

~~~
robmcm
I think they mean a framework that is like QT to build web apps, not a web
framework to generate native apps like QT.

------
_alexander_
I read this article several times, however I still have't understood how JS
and WASM will be live together?

If I can use C/C++ with static typing(of course if I can do DOM manipulation
from my C/C++ program) why I should use JS?

~~~
spicyj
Why would you ever use any language over C/C++? Different abstraction levels,
type systems (or lack thereof), ecosystems of libraries, even syntaxes all
contribute to a decision in choosing a language.

You might not like JS personally but there are plenty of things to like about
it and many other people do.

In practical terms, browsers will support JS forever for backwards
compatibility even if all new code is written in WASM.

~~~
_alexander_
Personally I really like JavaScript and I use it many years.

------
barrkel
FTR, Turbo Pascal also allowed you to write in assembler - the built-in
assembly was well integrated with the language, too, doing things like
referencing record offsets symbolically. If you could live with the
limitations, it was pretty nice.

------
amelius
> No built-in automatic garbage collector

This is cool, because this means people will implement their own garbage
collection mechanism, which could lead to interesting innovations.

~~~
golergka
> interesting innovations

Modern computers getting slow at 20 tabs of typical news sites articles is
already pretty interesting. But I can't wait to see how can we innovate this
even further!

~~~
ethbro
_> 20 tabs of typical news sites articles_

I'm impressed you can read 20 articles at once! (Said only half jokingly. I do
the same thing, but optimizing my behavior is probably the better solution to
slowness)

~~~
golergka
That reminds me of an awully old joke: "I wish I had enough disc space for
2-gigabyte swap file. — Why the hell do you need a swap file so large? — I
don't. I just need the space."

------
kristaps
I read the news back in June, but haven't followed WebAssembly since, any
interesting developments lately?

~~~
csvan
The V8 team recently announced that they will be implementing WASM.
[https://groups.google.com/forum/#!topic/v8-users/PInzACvS5I4](https://groups.google.com/forum/#!topic/v8-users/PInzACvS5I4)

------
shultays
>A new language: WebAssembly code defines an AST (so does JavaScript)
represented in a binary format. You can author and debug in a text format so
it’s readable.

Heh, since every binary executable has a non-compiled source code somewhere
out there, can we call them readable too?

~~~
Manishearth
I don't think that's what they're saying; they're saying that wasm has a
somewhat-readable textual representation. Not a precompiled/decompiled
program, a one-one mapping from the AST to the text format. Or something.

Think of it like how assembly is to machine code, but probably more readable.

~~~
Rusky
The intent is exactly like assembly/machine code, though they haven't really
nailed down the format yet. Current implementation(s?) just use s-exprs,
though I don't think they want that to be the final form.

------
IvanK_net
I am still a little skeptical about this new language. It is not so hard to to
write optimizable JS. And when you need a real performance boost, most of such
tasks are parallelizable, so you can use low-level WebGL or WebCL.

~~~
nv-vn
This isn't meant to replace the code you're writing, but rather serve as a
target architecture for compilers. It may also end up speeding up your
JavaScript if you compile it down, but the biggest difference will be to the
current "compile-to-javascript" languages (TypeScript, Elm, Dart, etc.)

------
crdoconnor
Sounds like it's opening up a whole new world of potential exploits.

~~~
Rusky
No more than the typical bounds checking done for asm.js byte buffers. It's
nothing like NaCl.

------
neikos
Another thing to block in my browser I suppose.

~~~
wtetzner
Why? It's functionally equivalent (at least for now) to asm.js, which is just
a subset of JavaScript.

------
msandford
This sounds great, but it's going to make it so, so much easier to spy on
people and hide all kinds of nastiness in web applications.

Worse is that tons of web applications that get exploited won't be understood
by the people who run them. Wordpress is a total minefield right now and it
gets hacked all the time. What'll happen once they have a module that compiles
up web assembly output for all the other modules running to speed things up?

EDIT: wordpress the thing you install yourself, not wordpress the hosted app

~~~
spyder
First:

WebAssemly will have a readable text format for view-source functionality:
[https://github.com/WebAssembly/design/blob/master/TextFormat...](https://github.com/WebAssembly/design/blob/master/TextFormat.md)

Second:

 _"...so much easier to spy on people and hide all kinds of nastiness in web
applications."_

What kind of spying and nastiness? WebAssembly will not have more access to
your data than the JavaScript API. It will have access to the same API as
JavaScript. For example if it wants your location it will call the same HTML5
location API and with the same restrictions, with the permission popup. Or
setting cookies will also call the same API. And thanks to the built-in
developer tools in browsers you can check the outgoing requests to see what is
sent and to where.

~~~
msandford
Readable text format at a much lower level of abstraction than javascript
currently is at right now. Different is different.

It's not so much about spying on your computer and gaining extra access, it's
obvious (short of implementation bugs) that you won't gain any additional
privileges that way.

But what you will gain is a way to obfuscate _extremely well_ "report such and
such to some webserver" in a way that's difficult to detect. For example, you
can hide the entropy inside of a fairly innocent looking URL and without a lot
of digging you won't know _what_ that entropy represents. It can look like
just a plain jane resource request and the webserver can serve up the exact
same resource no matter what the entropy is, but also record that entropy for
a back-channel way of exfiltrating information from your browser.

Finally, it opens up a whole new world of compiler attack. Right now the
attacks against wordpress involve writing some information into a file and
making it look "weird but I don't know what it does so I'd better not touch
it".

What happens when breaking into a wordpress install means that you can execute
the equivalent of the untraceable compiler login exploit insertion attack? You
can't perform this attack without 1) a compiler and 2) a low level target
that's hard to understand. You don't even need to perform a stage 3 attack
which is the most sophisticated, a stage 2 would do fine.

[https://www.ece.cmu.edu/~ganger/712.fall02/papers/p761-thomp...](https://www.ece.cmu.edu/~ganger/712.fall02/papers/p761-thompson.pdf)

