4 ms·
> why not just use Lua? Because there isn't "true" REPL. Non-homoiconic languages don't have the same kind of REPLs, because every step in them - Read, Eval, P
by iLemming 1y ago
> why not just use Lua?
Because there isn't "true" REPL. Non-homoiconic languages don't have the same kind of REPLs, because every step in them - Read, Eval, Print and Loop have slightly different semantics.
I just wrote my Hyprland config in babashka - native Clojure scripting engine. Once I build a socket management function that connects me to hyprctl, I was able to do the rest from within my editor connected to the REPL. I would write (hypr-cmd :clients), eval it, get the list of windows in my WM, and then filter, group, sort, etc. It is so much nicer to build things "from within", most people who never experienced that, wouldn't get it.
I'm running my WM and fully controlling it by writing code and executing it in-place, from the editor running in that same WM - without saving the code, without compiling it, without restarting the WM or my editor. I'm programming my shit as if I'm playing a video game. If I was a game developer, for sure, I would stick to the same mentality - why the heck work on a game, if I can build it by playing?
- johnisgood 1y agoWhat about Fennel, would that work? As for the rest, yeah, I have used stumpwm before and configured it on the fly. :D
- iLemming 1y agoFennel already "works". There's a small community of devs around it and in my opinion and practice, it remains a better choice to use instead of Lua directly. I don't even hesitate - whenever I need to tap into Lua-based engines, I would try to bootstrap Fennel on top - I use it with Hammerspoon, with Neovim, with mpv, and if I at some point I finally decide to switch to Wez terminal, I will for sure use Fennel. That being said, Fennel is nice but ain't ideal, it's rather weird. It tries to imitate Clojure syntactically, without actually posing as a Clojure dialect. Fennel is extremely thin layer over Lua - you're essentially writing Lua with s-expressions. In Fennel, you constantly feel Lua's presence (1-indexed arrays, table semantics, nil behavior), while Clojure abstracts over Java/JS/Dart/etc., much more heavily with its own semantics. I constantly feel like I'm missing good CLJ ergonomics - no built-in immutable data structures; no rich standard library; limited REPL experience; The difference in philosophy is that Fennel prioritizes being "just a syntax" for Lua and Clojure prioritizes being a "better language" that happens to run on JVM/JS/.NET/Dart/etc. Makes Fennel feel more like a transpiler - remember the days of Coffeescript? I guess, maybe all that actually makes Fennel more appealing to some - abstraction layer thickness sometimes does matter. I personally, wish for an actual Clojure dialect on top of Lua, rather than something "like Clojure".