News for hackers. Stuff that matters.
Re:Why am I excited about WebAssembly? by int_19h on Sunday July 17, 2022 @07:13PM (#32132511)
i.e. basically use JavaScript as if it were a statically typed language.
Re:Why am I excited about WebAssembly? by hajile on Sunday July 17, 2022 @07:53PM (#32132814)
Kinda. As long as you guard the boundaries of the parts that need performance, you can be a lot more flexible everywhere else. You see this in libraries like React where the external API is polymorphic, but they tend to pass through to calls that are monomorphic internally so performance is better.

I wish TypeScript helped more here. I'd prefer if it had a performance option that disallowed or at least warned about these kinds of things.

Re:Why am I excited about WebAssembly? by int_19h on Sunday July 17, 2022 @11:20PM (#32134252)
I wish we just ditched the JS legacy and had a properly statically typed language, with dynamism as a layer on top (like e.g. "dynamic" in C#), rather than underpinning anything.

Which is what wasm will, hopefully, give us in the long run. And ensure that said PL will have to remain competitive against the new contenders, since they can always replace it.

Re:Why am I excited about WebAssembly? by hajile on Monday July 18, 2022 @09:20AM (#32138025)
I think the reverse option is better. Add a `use types` directive to functions or modules. Inside those modules, use a very strict, structurally-typed ML-style type system that ensures good performance. If an untyped piece of code calls a typed one, coerce primitives and throw on objects that aren't a structural match.