5 ms·
Can it be considered "pure" when the project uses WASM ?
by dvhh 4y ago
Can it be considered "pure" when the project uses WASM ?
- natly 4y agoI think people just mean 'no server side ML' when they say pure JS in this context.
- werdnapk 4y agoSo pure browser or client side implementation then.
- lucideer 4y agoIn my experience "pure JS" is normally used to differentiate projects from those using NodeJS FFI - the important part is the target / executing runtime (which would be the JS runtime for WASM), rather than the project source. For my own purposes, the priority for me when reading "pure" is that the core runtime I'm using (the JS runtime) is the only runtime dependency - I'm not depending on external binaries and execution environments like an FFI implementation would. It also opens up codebases to browser compat, where FFI would typically not be available.
- pjmlp 4y agoWASM is a form of FFI.
- danShumway 4y agoWait, how so? WASM isn't an interface or a wrapper, it's a language/format. Having trouble understanding what you mean by this, unless you're arguing that the WASM VM itself is the FFI?
- lucideer 4y agoI can kinda see what they mean (albeit it's somewhat of a stretch). WASM "embeds" modules within the JS runtime, in a similar way that traditional FFI "embeds" native bindings compiled separately & externally. It's still quite different insofar as the VM is a part of the runtime, but there are vague parallels. For me though, the practical problems related to runtime env that one encounters with traditional ffi bindings calling dynamically linked native libraries are rarely present with a WASM library, as the support within the runtime is explicit (the only real exception here is architecture, which is always an issue regardless).
- pjmlp 4y agoIt is FFI from JavaScript point of view, a way to call multiple native languages from JavaScript, requires import and export definitions, a wasm file is no different than a .o, .a, .obj, .lib, other than not using instructions of a real CPU on the market.
- danShumway 4y agoI can sort of see this, in the sense that the style of code I'm writing when I use WASM is similar to the style of code when calling into an FFI. I think the implications of that code are different, but yeah, I see your point and I think it's fairly reasonable.
- yunohn 4y agoThis is actually a decent way of framing it. > A foreign function interface (FFI) is a mechanism by which a program written in one programming language can call routines or make use of services written in another. https://en.m.wikipedia.org/wiki/Foreign_function_interface https://en.m.wikipedia.org/wiki/Foreign_function_interface