Several interesting new features landed here, including pattern matching, quote/backtick, k/v destructuring, and a simpler way to define macros.
I’m one of the lead devs for the Fennel project; happy to answer any questions!
Edit: a link to the main site might be helpful too: https://fennel-lang.org
I notice you can use Fellel with tic-80. Very cool, I love that project! Definitely intend to do some hacking on that when I finally get my Clockwork Pi gameshell!
Maybe fennel will be the excuse I need to learn a Lisp like language :)
Are there any examples of a project written in Fennel? Maybe a video game mod that leverages the existing Lua interface?
Yeah, there are several examples listed on the Fennel wiki: https://github.com/bakpakin/Fennel/wiki
Games tend to dominate (especially love2d games) but there is also an IRC bot, text editor, web site, etc.
How does Fennel compare with something like Terra http://terralang.org?
My understanding is that Terra is a replacement for Lua, (both the compiler and the VM). Existing programs which currently embed Lua would need to be adapted to support the Terra runtime.
Fennel is a compiler that emits Lua code, and the compiler is implemented in Lua. This means that any existing program that embeds any version of Lua can run the Fennel compiler, or you can compile your Fennel codebase to Lua and run that on existing programs without them being made aware of Fennel at all. It’s much more broadly applicable.
(Also there are the obvious differences like Fennel is a lisp and Terra is more algol-ish.)
That clarifies things a lot. I know you can mix Terra and Lua within code but it helps to understand where you see the software fitting in.
Terra also lets you do metaprogramming with Lua, though I think the lisp model is a lot simpler and more consistent for metaprogramming. But Terra probably makes it a bit easier to drop to very-low-level code in the rare occasions where LuaJIT can’t optimize enough on its own.
Awesome, I’m very much looking forward to playing with k-v destructuring in fenestra
Is there a simple example of how to write a macro? I did check the web site, honest, though I may have missed it.
require-macrosform is documented in the reference: https://fennel-lang.org/reference
but I realized that the newer
macrosform for putting them inline isn’t mentioned there yet; you’ll need to consult the test suite for an example: https://github.com/bakpakin/Fennel/blob/master/test.lua#L258