News for hackers. Stuff that matters.
Re:Get Started with Rust, WebAssembly, and Webpack by bpicolo on Tuesday June 27, 2017 @12:13PM (#14646711)
"Number" and "i32" are entirely different types. What happens if you have an impedance mismatch?
Re:Get Started with Rust, WebAssembly, and Webpack by moron4hire on Tuesday June 27, 2017 @12:18PM (#14646758)
The most popular JavaScript engines do indeed have real integers available. You can get real Integers in regular JavaScript, they are just cumbersome. But if you're transpiling, you can hide that difficulty away.
Re:Get Started with Rust, WebAssembly, and Webpack by Franciscouzo on Tuesday June 27, 2017 @01:12PM (#14647218)
IEEE 754 double precision floats have enough precision to represent every 32 bit integer, the problem is when you try to use them to represent 64 bit integers, you get problems such as this: https://github.com/nodejs/node/issues/12115
Re:Get Started with Rust, WebAssembly, and Webpack by bpicolo on Tuesday June 27, 2017 @01:13PM (#14647237)
My question is: what happens when you pass something that's not an integer to the rust lib code via this?
Re:Get Started with Rust, WebAssembly, and Webpack by hackcasual on Tuesday June 27, 2017 @01:50PM (#14647577)
JavaScript also has somewhat arcane rules around when Number it's actually treated like an i32
Re:Get Started with Rust, WebAssembly, and Webpack by ianjsikes on Tuesday June 27, 2017 @01:43PM (#14647515)
Author here. It is my cursory understanding that the Emscripten SDK handles converting types to and from Javascript values and C-like data in the module's virtual memory. I'm not totally sure how that conversion is happening yet. I can tell you that when I pass a string when it expects an i32, it treats it as 0, so `add("foo", "bar") -> 0`
Re:Get Started with Rust, WebAssembly, and Webpack by bpicolo on Tuesday June 27, 2017 @03:40PM (#14648649)
Wonder if it will be possible to make it panic/error instead