hyperfiddle

respatialized 2025-06-05T19:37:59.076669Z

Potentially crazy idea, one that probably only works in a very niche context: use the Electric compiler to identify the boundaries between CLJ and CLJS code, but instead, compile the CLJ parts to wasm with Graal and run everything in the browser.

henrik 2025-06-05T19:51:57.545119Z

That would only work if you’re fine with having access to literally no APIs, including mounting DOM elements.

🤔 1
henrik 2025-06-05T19:52:17.186179Z

Oh, and no websocket

henrik 2025-06-05T19:55:57.043589Z

WASM works best for number crunchy things since you pay for serde every time you need to access browser APIs, and even then it should be pretty crunchy

🤔 1
xificurC 2025-06-06T06:13:16.751969Z

in theory server/client can be any of js and jvm, so e.g. the server jvm but client also jvm (a reactive swing or javafx client). Server could compile to js and run as a web worker. In practice we'd need a client requesting any of this to build it

Dustin Getz (Hyperfiddle) 2025-06-06T09:46:53.024569Z

i think wasm target for cljs is strategically valuable long term, it is the scripting language of the cloud (due to the security model)

Dustin Getz (Hyperfiddle) 2025-06-06T09:47:07.866359Z

but i don't think cljs core team is interested

Dustin Getz (Hyperfiddle) 2025-06-06T09:47:41.622499Z

once cljs supports it, presumably electric can support it fairly easily from there

Dustin Getz (Hyperfiddle) 2025-06-06T09:49:38.943539Z

i do not think wasm is niche, it is also the obvious target for durable execution platforms such as golem.cloud (john degoes's new project, he's the guy who made the Zio effect system which is the current state of art for building resilient microservices at scale used at aws search, disney streaming)

Dustin Getz (Hyperfiddle) 2025-06-06T09:50:56.343939Z

and electric is a perfect fit for durable execution

henrik 2025-06-06T09:56:01.070209Z

As a VM it’s one thing, but in the browser, I think it still needs to mature. I read a HN post about a year ago or so about a company that tried to make business of translating JS apps to WASM. It turned out to not be viable, because they could eke out maybe a 5% performance gain for an average app, but with significantly higher maintenance overhead. Things might have matured since then. That said, for things like Automerge, WASM has worked out well.

henrik 2025-06-06T10:03:21.395579Z

The dream of WebAssembly in the browser IMO is to have a “native” compilation target for all languages, but right now JS still enjoys special privileges, and will remain so until WASM matures and there’s enough adoption of that mature version.