3 ms·
I'm cheered by ongoing progress in adoption of WebAssembly. While Microsoft is often given minimal notice here, I urge anyone interested in WASM to experiment w
by RagnarD 3y ago
I'm cheered by ongoing progress in adoption of WebAssembly. While Microsoft is often given minimal notice here, I urge anyone interested in WASM to experiment with Blazor WebAssembly. It's an incredibly powerful framework that lets you use C# and most .NET libraries (including NuGet packages) as compiled WASM in the browser.
- hsbauauvhabzb 3y agoRe ‘most nuget packages’ What’s the limitation here? If it requires the ability to read a file on disk, does it straight up fail or does the file read interface push the action back into a server-side rendering type action?
- RagnarD 3y agoThe NuGet packages are zip files containing compiled binary and possibly other resources. They're referenced in the source code and included at compile time. Since they become integrated into the overall compile, there's no need to reference them in the final runtime product.
- hsbauauvhabzb 3y agoSorry that misses my point, blazor runs client side which means that it’s sandboxed with the same permissions as JavaScript executed within a page - you can’t use blazor to read a file client-side, but there’s nothing to prevent wrapping what would be a server side library in a way where ‘it executes on the client except when it can’t, at which point it executes on the server’ Doing so would almost always be a security risk, as validation would presumably still run client side, but that doesn’t mean it’s not possible to actually achieve such an engine.
- cyanydeez 3y agoLike most wasm, if the nugget is just a thin wrapper around a recompiled binary, it's not going to work. WASM is a compile target. So if the code source is available and it's "pure", most wasm can now compile it. Check out pyiodide for a extensive python project trying to bring everything in Python to the web. Your specific concern regarding file access: they just create something like a indexeddb file system if you want to work with files.
- deleted 3y ago[deleted]
- oefrha 3y agoFrom reading about it, it seems to suffer the same problem as Go compiled to wasm: payload is huge, usually multi-MB after compression.
- cyanydeez 3y agoIs there an article comparing other compile targets. I mostly get the impression that the compiler in browser is the problem. If it's adopted natively, that should disappear. All I'd need is Firefox, edge and chrome to switch to publishing wasm.