Live data from Hacker News

Why Fennel?

fennel-lang.org

51–60 of 106 posts

Re: Why Fennel?

#51
post #45

Earlier quoted context omitted.

It's a very common language to embed in video games as a modding and configuration tool.

And that's the sort of thing it's meant to do. Tools have their strengths. Use them for that. Don't try to drive a nail with a screwdriver.

this is a very vague statement. lua is used in a lot of environments and is very performant. you can use it inside nginx (openresty) to process requests at a pretty large scale. you can use it inside of redis.

lua and javascript are somewhat interchangeable aside from the fact that js has a much larger ecosystem.

sure there are situations where lua might be a bad choice but based on your remarks you make it sound like it sucks anywhere except inside a game engine.

Re: Why Fennel?

#52

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 adhe…

I think Fennel and Janet went separate ways fairly early on, and the creator of Fennel focussed primarily on Janet whilst the current maintainer of Fennel is responsible for much (most?) of what you see in Fennel today...So some very different design choices between the two languages, i believe.

Re: Why Fennel?

#53

Earlier quoted context omitted.

Can nvim read it natively or do you need to transpile it?

I use a plugin called Aniseed which loads first and does the transpiling on the fly for me.

I linked to aniseed originally, but nfnl is what Olical is pointing people toward now?

Re: Why Fennel?

#55

Earlier quoted context omitted.

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.

What else is there apart from an editor and a lispy config language?

I always thought of emacs as that, i.e. an editor that is extensible and dev friendly (in contrast to vimscript). I don’t know much about emacs though, so this got me curious.

Re: Why Fennel?

#56

> 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?

This is mostly based on my experience in the past with Lua circa 2015 when I developed a GUI using Crank Storyboard Engine and needed to write some stuff in C because the Lua equivalent code was too CPU-intensive.

If I remember correctly, Lua is a stack-based VM. What this means is that every piece of data has a corresponding location on a stack data structure in-memory. Function arguments are pushed into the stack as-needed and popped in the function context, and vice-versa for the function return values.

If you wanted arity-checking in this context, you'd have to confirm that you got exactly the right number of elements on the stack, meaning there would be an extra branch in every function call. This might reduce performance if the branch predictor gets it wrong. Plus there would need to be extra instructions to count and to check the count for each pop off the stack in the context of the function call.

This is from the perspective of calling C functions in Lua, so it's probably more complicated for the VM itself when it's running native Lua code.

Re: Why Fennel?

#57
post #55

Earlier quoted context omitted.

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

What else is there apart from an editor and a lispy config language? I always thought of emacs as that, i.e. an editor that is extensible and dev friendly (in contrast to vimscript). I don’t know much about emacs though, so this got me curious.

Well the famous joke is "Emacs is an OS that lacks a decent text editor." (Yes Evil mode exists)

Emacs can do basically anything you write an extension for it to do. It can be your calendar, your email client, your rss reader or even your git gui on top of being an editor. Emacs can do so much that it's daunting to start using.

Re: Why Fennel?

#58
post #25

Now I like lua and think single pass is the way to go for interpreted, since you don't have the disadvantage of a slow compile time no matter how big your codebase gets, BUT its not great to write in. some things are (apparently) not possible, which means the only solution is to transpile into it, which has led to some good languages like moonscript[0], and the dynamic nature is a boon as your codebase grows, which h…

Don't forget Terra as well: https://terralang.org/

Re: Why Fennel?

#60

I've been wanting to give Fennel a try, currently I use Moonscript for my Lua transpilation ( https://moonscript.org/ ), but it has some criticisms and it can be a bit confusing sometimes.

I'm a big fan of moonscript, but occasionally wish it was still being improved and worked on. Yuescript¹ looks like it fixes most of my bugbears with moonscript, and is for the most part a faster² drop-in replacement.

There was s little discussion here ~18 months ago³, but it will feel largely circular if you look at it as people are suggesting fennel there ;)

¹ https://github.com/pigpigyyy/Yuescript

² This probably only matters if you have tonnes of moonscript, not just a little neovim/mpv/awesomewm config or something.

³ https://news.ycombinator.com/item?id=29903133

Post reply on HN