Hacker News new | ask | show | jobs
by jwr 1071 days ago
I'm going to be the Smug Lisp Weenie here (I wonder who gets the reference), and comment on this:

> One of my favourite things about creating sparklines like this is that I can create the SVGs entirely on the backend. I don’t need to worry about using a JavaScript charting library, or sending the “points” data to the frontend. The browser requests an SVG. The server returns it. Simple!

Me, I don't care where I create the SVGs. Most of my Clojure code is shared between backend and frontend (compiled and running on the JVM in the backend and compiled to JavaScript in the frontend). So I can generate SVGs wherever, it doesn't matter, the code is only written once. Or rather, it might matter, because my website uses server-side rendering, so the same thing must be generated on both sides.

I'll see myself out now.

3 comments

I mean... isomorphic code isn't unique to Clojure & is how many JS/NodeJS apps work...
Of course. But I'm a Smug Clojure Weenie, so. :-)
Fair
> I wonder who gets the reference

https://news.ycombinator.com/user?id=kennytilton sure does. :D

What's Clojure's WASM story like? That would be much more exciting than having to transpile to JS.
Wasm is not an good compile target for it. It's made for C/C++/Rust type static, native-code languages. You would basically have to build the same kind of runtime environment implementation as you'd need for a native-code managed VM.

(That's why for example Python works well on WebAssembly - it comes with its own interpreter written in portable C that compiles nicely to WebAssembly, and uses reference counting for GC instead of a fancy GC).

Since Clojure is mainly a hosted language, a more likely avenue would be one of its current platforms gaining WebAssembly support. A Wasm JVM, or Wasm GraalVM target, for example.

Why would it be more exciting?

I've been running a massive SaaS app for the last several years. JavaScript is not a performance problem, especially after compiling using the Google Closure compiler "advanced" mode. Rendering is a performance problem: think large tables. WASM would bring me no significant advantages.