4 ms·
It's still there - you can still do I/O in C, even if you have to call a library function. In WebAssembly, there's no mechanism for I/O of any sort.
by cjs_ac 1y ago
It's still there - you can still do I/O in C, even if you have to call a library function. In WebAssembly, there's no mechanism for I/O of any sort.
- flohofwoe 1y ago...in WASM you also call a function to do IO though? That function is just provided by the host environment via the function import table, but conceptually it's the exact same thing as a Linux syscall, a BIOS int-call or calling into a Windows system DLL.
- marcosdumay 1y agoAs long as that function doesn't receive any parameter that is like any data actually on the DOM. So you either create a very concrete JS library that translates specific WASM data into IO actions, or one that serializes and deserialize everything all around but can be standardized. At this point, none of those options are much more capable than Java applets... Or, in fact, if you put a network call between the WASM and the JS, you won't even add much complexity.
- flohofwoe 1y ago> At this point, none of those options are much more capable than Java applets Java applets allowed to load and call into native DLLs via JNI, so they were definitely much more capable than WASM, but also irresponsibly unsafe. In your own WASM host implementation you could even implement a dlopen() and dlsym() to load and call into native DLLs, but any WASM host which cares about safety wouldn't allow that (especially web browsers).
- nostrademons 1y agoThat's not really much different from writing a language runtime for any other OS. If you're writing the Linux or Windows IO routines for say Haskell or Python or Scheme, you're writing them in C, and then you either call into them from the language's FFI or invoke platform ABI calls into the runtime from the compiled code.
- 3836293648 1y agoBut that's not the (original) argument being made. Just as IO belongs in POSIX and not C, DOM access belongs in some other standard, not WASM
- cookiengineer 1y agoThere is, it is just called WASI and it specifies syscalls in a different way. WebASM is an assembly-like dialect, after all.