Hacker News new | ask | show | jobs
by capableweb 1112 days ago
Something similar: Fennel (https://fennel-lang.org/) is a lisp that compiles into Lua, which neovim can use as plugins, so you can write neovim plugins in a lisp. Aniseed (https://github.com/Olical/aniseed) makes this really easy.

Aniseed is also used by Conjure (Interactive development environment for neovim, used for evaluating Fennel code inside of neovim), which is also made by the same author. Really great plugin for doing Clojure development with neovim. https://github.com/Olical/conjure

3 comments

I've said this before but I think fennel is one of the most impressive languages around. Lua has a good reputation but I've used it professionally and find it one of the more practically painful languages to work in. Apparently fennel's author agrees, because fennel is laser-focused on correcting exactly its worst problems.

AND/BUT one of fennel's impressive things is that it sticks rigidly to lua runtime semantics. Which I found a little repulsive at first but has huge benefits in its context. You can drop fennel into any version of lua on any runtime (bc they vary a lot) and it works the same. You can hook the single-file fnl compiler into lua's module loader and mix fennel files into an existing lua program, freely sharing functions and metatables both ways.

Very flexible and powerful because of that tradeoff. Anywhere I have to use lua now I am actually using fennel.

The downside is this choice precludes it from having the clojure-like data structures and reference types. It could add a new standard library but doesn't, limiting itself to a handful of special forms (notably pattern match thank god) that mix nicely with the existing lua primitives. It looks like TimL has gone the other way with that decision, which I also appreciate. Makes it maybe a less flexible general-purpose lua replacement/extension, but probably makes it more powerfully suited for the specific purpose it'll be used for.

The same author also wrote Janet, which is also a nice language from what I’ve played around with. Especially the idea of forgoing Regex entirely and going with PEGs, as well as having “defs” inside functions bind local variables instead of “let” (though let is also idiomatic), very interesting. Small languages like that give a very nice feeling of learning them in a single day.
I looked into that language for exactly that reason and like it quite a lot. It's very good for scripting, though that is a crowded niche these days. It's also not much harder to integrate than lua, so I've used it a few times for an integrated scripting language when I didn't actually need a teeny tiny runtime.

And yeah you end up really missing PEGs in other languages. There are libraries, but having it built in is another thing especially with how well they fit into s-exp syntax.

I use Aniseed, but it's worth noting that it's something like a "framework" on top of Fennel and Neovim. So I also want to shout out Hotpot, which is more of a simple plugin that allows you to put plain Fennel files in your runtime path, without any additional "framework" to learn.

That said, I think the framework that Aniseed introduces is really nice, and I think would be useful for writing general purpose programs outside of Neovim.

I'll second Conjure. I use it for (Gerbil) Scheme, and it makes it so much better. I really wish there was better support for non-Emacs editors in the Lisp ecosystem. Or really just a stronger Lisp ecosystem...