Gave WASM a try and ran into problems exposing connections to a SQLite database I wanted to connect to locally. Has anyone done something like that before and can point to good resources?
Check out Spin! It includes sqlite support natively in the runtime since 1.4: https://www.fermyon.com/blog/spin-v14
Learn WebAssembly by writing small programs
41–50 of 87 posts
Re: Learn WebAssembly by writing small programs
#42Earlier quoted context omitted.
Check out Spin! It includes sqlite support natively in the runtime since 1.4: https://www.fermyon.com/blog/spin-v14
Looks like it’s only available for Python, I was hoping for a more language agnostic solution. Thanks though!
https://developer.fermyon.com/spin/sqlite-api-guide#using-sq...
I'm not sure what holds back from being a completely language agnostic solution, but I know when I tried binding functions into my Ruby app with wasmer I had nothing but problems, I wound up using WASI exclusively to communicate with my WASM modules. I don't honestly know how good the WASM language agnostic story is today. I gave a talk with my perspective as a Rubyist at OSS Summit and CDCon/GitOpsCon a few months ago in Vancouver. The talk (and lightning talk variant) are called "Exotic Runtime Targets: Ruby and Wasm on Kubernetes and GitOps Delivery Pipelines"
Re: Learn WebAssembly by writing small programs
#43Is it just me, or does "WebAssembly" seem like an oxymoron? Maybe it's because I've been involved with the web since its earliest beginnings.
You might like this bit of speculative history: https://www.destroyallsoftware.com/talks/the-birth-and-death... >
Re: Learn WebAssembly by writing small programs
#44Earlier quoted context omitted.
I've been watching WASM from afar, and it's my understanding that it's not a JS killer because it doesn't have direct access to the DOM or to most DOM APIs. I'm curious if there's another reason I'm missing?
Is being a "JS killer" even a goal of WASM? From what I understand, WASM's goal is to allow computationally heavy workloads (e.g., image and audio processing) to the browser by providing a compilation target for C code. This is how we get nice things like Figma or MS Office running in the browser. Let WASM do the number crunching, let JS do the UI.
For a lot of companies the only place JavaScript is ever used is on their website frontend. And it makes you wonder, why does it even still need to be JavaScript? With the rise of SPAs and the fall of normal document based websites, browsers are basically just becoming their own platform like Windows Desktop, Mac, Linux, Android, iOS, etc. You could say it's been that way for a long time, but more and more apps are becoming web based only because the browser is now powerful enough to run what used to be a desktop application.
Browsers are literally just a VM with an address bar. We go to a URL and run a program, except right now there's basically the limitation that the program has to be written at least partly in JavaScript. Being able to deploy an entire website as WASM is just the next logical step from what I see.
Re: Learn WebAssembly by writing small programs
#45Re: Learn WebAssembly by writing small programs
#46Is there a WA UI framework for web similar to Svelte or Vue?
Hand written wasm is too low level to use a UI framework with, but there are rust frameworks that compile to wasm for web. For example, Yew and Leptos are both web-first frameworks, and there are a few such as Dioxus or wgpu that are native-first and work on web.
It isn't, really, what the Rust frameworks do is compile down to a specific interop, sure (JS + WASM, its not pure WASM due to lack of DOM access for starters).
That said, no reason a hand written WASM app isn't feasible, with appropriate JS glue
Re: Learn WebAssembly by writing small programs
#47Earlier quoted context omitted.
I've been watching WASM from afar, and it's my understanding that it's not a JS killer because it doesn't have direct access to the DOM or to most DOM APIs. I'm curious if there's another reason I'm missing?
Yep. Give access to the DOM - perhaps via a batch update/fragment mechanism and watch as it becomes a JS killer. But WASM is currently a starved prisoner locked up in a room only allowed to view the goodies outside the cell door.
Re: Learn WebAssembly by writing small programs
#48As WebAssembly becomes the lingua franca of different ecosystems, having a strong grasp of how it works is worth the time investment. Thanks for this.
Re: Learn WebAssembly by writing small programs
#49Re: Learn WebAssembly by writing small programs
#50Looks very similar to the Exercism model, which also has a free WASM course filled with small exercises[1]. I wonder if the author considered contributing to that course or working together with them, it might get their work to a broader audience and leverage the existing toolset Exercism has to offer. [1] https://exercism.org/tracks/wasm
In other words, it's just a bunch of leetcode-like questions, ordered by difficulties.
A proper course should order the exercises by language features. Exercism actually has built a fantastic interface for this[1], but not utiltized it for most langauges.