Hacker News new | ask | show | jobs
by conartist6 5 days ago
> to implement anything similar to Emacs, you'd need a homoiconic language

I've got that. It took 6 years but I developed a comprehensive homoiconic layer for Javascript

2 comments

How does that work? Homoiconicity is a property of the language, not something you can develop as a layer.
JS was already pretty close. Babel allows a fantastic degree of power in code transformation, it just doesn't preserve blank space.

If I were to use my preferred terminology I would simply call these transform-your-own-code formats "embeddings", and there can be many embeddings for a single language.

> Babel allows a fantastic degree of power in code transformation

That's still not homoiconicity. It reminds me old Stuart Sierra's presentation from Clojure/conj¹. Around 6 minute mark: "Adding eval to a language, even successfully, does not count as homoiconicity"... "and you didn't even succeed at that..."

---

¹ https://www.youtube.com/watch?v=o7zyGMcav3c

I'm sorry, but that's not homoiconicity. I'm not trying to devalue your work (if you're talking about BABLR/CSTML), but you really cannot bolt homoiconicity onto a non-homoiconic language with a layer, because the defining trait is the absence of a layer.

It doesn't look like your real goal was homoiconicity at all, but rather "stay in JS semantics, keep the JS ecosystem, and build structural editing over any language". Homoiconicity is a word you grabbed to borrow from Emacs's fame, but not a requirement you're were ever trying to satisfy. If it was the actual requirement, there are dozens of options that exist already - Squint, cherry, Clojurescript, Scittle, Fennel-to-JS, even Gleam - any of them gives you code-as-data cheaply.