Top
Best
New

Posted by behnamoh 4/13/2025

Why Fennel?(fennel-lang.org)
277 points | 163 commentspage 2
akoboldfrying 4/14/2025|
I'm a bit puzzled by whether Fennel is trying to make "different things look different" as they claim, or not. On the one hand, Fennel separates Lua's multipurpose "for" into "for" (for numeric ranges) and "each" (for iterators). On the other hand... Don't macros and function calls, two rather different things with different powers, look identical in Fennel?

On the "Values" page, they also mention a macro that alters the lexical scope somehow. This macro is now deprecated, but its mere existence implies that such a macro can be expressed in Fennel -- that is, that it's possible to write Fennel code that causes what looks like an ordinary function call to do surprising things to the program state.

As they rightly mention (on either this page or the "Values of Fennel" page), the advantage of constraining a language is that you can more easily tell what a program is doing (and not doing) at a glance. But this seems to be undone by giving a pass to (unhygienic?) macros.

z5h 4/14/2025||
Ok I’m genuinely convinced I’d be happier using Fennel than using Lua in instances where I need to use Lua. I’m not currently using Lua for anything. Maybe if I write a Pico-8 app…
djaouen 4/13/2025||
I like the popularity of Fennel so that I can greedily keep Hylang and LFE all to myself!
ersiees 4/13/2025||
I don’t love fennel, it usually dominates the whole taste of a dish for me
stronglikedan 4/14/2025|
But in the spirit of answering the headline's question, it's because nothing else tastes quite like it!
RKFADU_UOFCCLEL 4/14/2025||
Is it a theorem that languages named after trendy (such as spices) or shiny things die fast? Ruby, Crystal, Carbon, now Fennel.
R4tY9jQ2 4/13/2025||
[dead]
giraffe_lady 4/13/2025||
Another spot it's great for is in legacy lua programs that you inherit from who knows where, which in my experience is a lot of the live lua out there. It hooks into the module loader system so you can just freely mix functions and tables between the two.
quectophoton 4/13/2025||
> Fennel's approach of compiling to Lua while maintaining meta-programming capabilities is elegant.

Yeah, it is very nice to work with.

The only tiny "complaint" I have is that it doesn't compile to pure Lua, but instead assumes you'll be running it together with Lua's libraries.

I say this because, for me, the places where I'd like to use Fennel have a lot of overlap with the places where I'd like to use Lua without loading any of the provided libraries (e.g. embedding Lua into other software, instead of using it standalone).

giraffe_lady 4/13/2025||
Wait what do you mean? If I understand you correctly I use fennel for this all the time, I just copy the compiled lua into the place the program expects to find lua scripts.
MyOutfitIsVague 4/13/2025|||
Sandboxed lua can't assume it has access things like debug libraries or any of the file IO, among other things. Many setups pretty aggressively remove and/or patch libraries and even large parts of the default global table. Assuming a vanilla lua library environment can make a project like this unusable in many places.
giraffe_lady 4/13/2025||
Oh, sure. I didn't realize fennel used those libs in the compiled lua output if you don't call to them. I've never run into this problem and again I've written a lot of fennel that is targeting locked down scripting environments. I probably don't use all of its features though so maybe just got lucky so far.
quectophoton 4/13/2025|||
I might be remembering wrong on where the problem was exactly, but it was either the generated code, or the code for the Fennel transpiler itself.

I just know that I tried to use it without loading Lua's libraries (i.e. without calling the `luaL_openlibs` function or equivalent) and was unable to.

> I just copy the compiled lua into the place the program expects to find lua scripts.

Yeah most existing programs just load all Lua libraries by default, so that's generally not an issue.

My post is more from the point of view of embedding a restricted Lua interpreter into a program (i.e. only Lua-the-language, not Lua-the-language-plus-its-libraries) while still supporting Fennel.

---

EDIT: Just checked, the Fennel code `(lambda [foo bar] bar)` compiles to Lua code that calls `_G.assert`.

NoPicklez 4/14/2025||
Why not Fennel?
imbnwa 4/13/2025||
If I'm writing an advanced Neovim config, I'd find YueScript[0] a lot more pertinent. Personally I can't deal with Lisp paren noise, I can hardly deal with semicolons.

[0]https://yuescript.org/doc/

zitterbewegung 4/13/2025|
Linking to this without the fennel-lang.org main page which states the following

"Fennel is a programming language that brings together the simplicity, speed, and reach of Lua with the flexibility of a lisp syntax and macro system." is a bad idea. Not having this sentence on your justification is ill advised.

Not to detract from the language or anything I have found many programming languages justification to just not have an elevator pitch and I have a hard time understanding why this is the case. Unfortunately people's attention spans are extremely short.

fredrikholm 4/13/2025|
> Not to detract from the language or anything I have found many programming languages justification to just not have an elevator pitch and I have a hard time understanding why this is the case.

But they do have one, that you just copied?

davidcalloway 4/13/2025||
I'm pretty sure the parent comment is pointing out that the quoted sentence from the main page ought to be present in the rationale page that is linked.