Live data from Hacker News

Why Fennel?

fennel-lang.org

11–20 of 106 posts

Re: Why Fennel?

#11
> yet keeps a very small footprint both conceptually

it's only a benefit for writing simplistic things (and configs for some complicated programs like a text editor or a terminal or some MMORPG is already not simple), otherwise you start appreciating that there is not just a single dictionary as a data type etc.

Re: Why Fennel?

#12

> Another common criticism of Lua is that it lacks arity checks; that is, if you call a function without enough arguments, it will simply proceed instead of indicating an error. Fennel allows you to write functions that work this way (fn) when it's needed for speed, but it also lets you write functions which check for the arguments they expect using lambda. I don't understand this; why is this a speed consideration?

Caveat: I haven't used Fennel but just inferring from what makes sense...

The Lua VM that they compile to already handles missing arguments with some attendant but unavoidable performance cost.

Fennel's own `lambda` form that they layer on top does check for missing arguments, but it must do so by generating extra Lua code to do those checks. That additional code has a runtime cost.

Using `fn` avoids that extra generated code and its cost.

If Fennel had its own runtime and VM, then the performance story for how missing arguments are handled would be different.

Re: Why Fennel?

#15
I always say this when it comes up but fennel is very very impressive as a language project. Lua is much beloved but my professional experience is that working with it gets gnarly much faster than most other languages. Fennel focuses on a small set of the worst lua issues and addresses them without getting distracted or bogged down in language design extravagances or lisp nerd semiotics.

The decision to strictly adhere to lua runtime semantics was initially repulsive to me, but I've come to appreciate the incredible wisdom of that approach. The practical experience of using lua is that because of the constraints of the language, every lua runtime is in some ways custom & unique. This decision of fennel's creator allows you to drop fennel onto any lua codebase, of any version, with any amount of custom freak shit grafted in, and just use it. Not only use it, but hook its compiler into the lua module loader system, and freely & transparently mix functions and tables between the two languages. A life raft in decrepit legacy lua codebases.

The restraint and technical focus of this language led to me checking out janet, another project of its creator. I've also come to really like that language, it makes some similarly minor-seeming but brilliant decisions like including PEGs in the core lang instead of regex.

Anyway try fennel, if you have to interact with a lot of lua pattern match alone will improve your life. Try janet too it's cool.

Re: Why Fennel?

#17

I moved my Neovim config to fennel and haven't look back. https://github.com/Grazfather/dotfiles/blob/master/nvim/fnl/...

So basically Emacs with Elisp replaced with Fennel and a more responsive UI...

Emacs is a whoooooole lot more than an editor and Lispy config language.

Re: Why Fennel?

#19

> Another common criticism of Lua is that it lacks arity checks; that is, if you call a function without enough arguments, it will simply proceed instead of indicating an error. Fennel allows you to write functions that work this way (fn) when it's needed for speed, but it also lets you write functions which check for the arguments they expect using lambda. I don't understand this; why is this a speed consideration?

Because it’s an extra runtime check vs a direct lua call
Post reply on HN