3 ms·
From the last paragraph: > But JavaScript and TypeScript scripts calling into WebAssembly code will be increasingly common. Why is WebAssembly a key concept h
by kostarelo 6y ago
From the last paragraph:
> But JavaScript and TypeScript scripts calling into WebAssembly code will be increasingly common.
Why is WebAssembly a key concept here? How does Deno uses it?
- lucacasonato 6y agoWe use it for the hash module in our standard library for example: https://deno.land/std@0.91.0/hash https://deno.land/std@0.91.0/hash. The wasm version is magnitudes faster than a pure JS implementation. Another example is sqlite, running in WASM: https://deno.land/x/sqlite@v2.4.0 https://deno.land/x/sqlite@v2.4.0. Fully sandboxed sqlite :-)
- int_19h 6y agoIt will be the ultimate irony if, 20 years down the line, Deno is still around, but solely as a de facto standard / cross-platform WebAssembly execution engine.
- e12e 6y agoWhy would that be ironic? It's essentially the route Java is taking with graal/truffle - allowing heterogeneous mix of languages to be compiled and optimized. Why not allow typescript to use Fortran numeric libraries via wasm?
- int_19h 6y agoJavaScript in Deno doesn't itself run on top of WebAssembly, so this isn't really quite like Graal. If you use Deno to run wasm, all the JS bits are basically ignored. It's a bit like using a web renderer solely for <canvas>.
- tsujp 6y agoYou can write in other languages beyond JavaScript or TypeScript and generate WebAssembly. This means that say someone wrote a nice library or utility in C# you can compile that C# down to WebAssembly and use that library or utility in JavaScript or TypeScript (or anything else that can access WebAssembly). This is analogous perhaps to C# and F# within .NET currently. C# and F# have the same BCL (base common layer) so you can use C# code in F# and vice versa. WebAssembly is like that and much more.
- int_19h 6y agoWebAssembly would be analogous to CLI (Common Language Infrastructure) in .NET land, which includes CIL (Common Intermediate Language - bytecode) and CLR (Common Language Runtime - VM). .NET BCL is the Base Class Library. Outside of a few classes in it that are fundamental to the runtime (e.g. Object, String, Array), it's not actually required for cross-language interop on .NET platforms. E.g. if you have two different C compilers both outputting CIL, they can interop just fine without any objects in the picture. WebAssembly interop is really more like that, and doesn't have the high-level object model layer that .NET also has (and which is used in practice).