6 ms·
To the extent that asm.js and JavaScript are, yes. Everything is well-defined, so in theory any Turing machine should be able to run it, but it's certainly goin
by TazeTSchnitzel 9y ago
To the extent that asm.js and JavaScript are, yes. Everything is well-defined, so in theory any Turing machine should be able to run it, but it's certainly going to be easier to implement efficiently on a typical modern 32-bit or 64-bit CPU in a computer or phone than on something more unusual.
- k__ 9y agoSo I could write an application in, lets say Rust, compile it to WASM and run it on Linux, macOS and Windows browsers without anything extra?
- jonloldrup 9y agoyes, but the API you'll code against is limited
- roca 9y agoThat's not really true. With JS glue code (including many libraries already written) Wasm modules can access anything JS can do. E.g. there are Wasm demos showing access to WebGL2, audio generation, camera/microphone, HTTP, storage, gamepads, ...
- TazeTSchnitzel 9y agoYou have the full Web API, yes, but it's limited compared to native, although sure, it's nonetheless very capable.
- camus2 9y ago> E.g. there are Wasm demos showing access to WebGL2, audio generation, camera/microphone, HTTP, storage, gamepads, ... All web API. nothing a Javascript app in the browser can't do.
- TremendousJudge 9y ago>nothing a Javascript app in the browser can't do. not being written in Javascript is a great advantage
- livingparadox 9y agoThat's the point. a WASM app has access to the same Web APIs that JS does, for the most part. This was in response to the claim that WASM only gets to work off of a limited api, not an argument as to why WASM is an improvement over JS.
- dtzur 9y agoYes, that's the goal
- TazeTSchnitzel 9y agoYep! It's a completely portable target and fulfils the promise of “compile once, run anywhere”, although how well it runs depends on the particular browser. (It is pretty amazing you can compile C code to something that actually runs on multiple machines, it's very nice.)
- k__ 9y agoYes, this sounds awesome. Can this be used as alternative to native modules in Node.js?
- bobbytherobot 9y agoThat is a good question. I imagine it depends on why it is a native module. If they are native module because it utilizing features at the OS or machine level, then I doubt they could.
- TazeTSchnitzel 9y agoWell, whatever syscalls you want to make could be made by node.js for you, though that quickly veers into absurdist territory.
- markdog12 9y agoYes, search for remcob's answer on this page
- makomk 9y agoWhich is to say that they assume little-endian just like asm.js and modern JavaScript do. Architectures other than ARM and x86 are mostly dead so this isn't generally a huge problem except for the handful of die-hard Amiga users.
- kuon 9y agoPowerPC and SPARC are still around and well, no? (haven't checked in a while, and I remembed something about PowerPC being able to switch endianess)