Hacker News new | ask | show | jobs
by technomancy 2823 days ago
The creators of Fennel and Urn both chimed in to describe the differences between the two here: https://news.ycombinator.com/item?id=16567763

tl;dr Urn is a much bigger language that happens to compile to Lua as an implementation detail. Fennel is much closer to Lua and is dramatically simpler, only diverging from Lua semantics when the changes can be implemented purely at compile time. (immutable locals, blocking accidental global references/setting, etc) The compiler output from Fennel tends to be pretty readable and looks a lot like the input.

If you need to write code that runs in the browser, Lumen is one choice, but you can also run Fennel in the browser using Fengari: https://fengari.io/ I know next to nothing about frontend development but was able to integrate Fengari into https://fennel-lang.org to get the live REPL working with ease.

2 comments

Yes, I had a comment in that older HN thread. I think this has me moving towards Fennel when compared with Urn, since I want a smaller language, but the examples of Lumen in this HN thread:

https://news.ycombinator.com/item?id=17958650

are swaying me to spend some time with Lumen this weekend to understand how it compares to Fennel. The Lumen examples were pretty impressive and it works for JavaScript too.

I tried the live repl and input the fibonacci example:

  > (fn fib [n]
   (if (< n 2)
    n
    (+ (fib (- n 1)) (fib (- n 2)))))
which seemed to take, but then upon trying

  (print (fib 10))
it spit out the following:

  [string "return print(fib(10))"]:1: attempt to call a nil value (global 'fib')
Do I need to initialize fib before in the repl?
It works if you run both expressions from file. There's a tutorial page that explains why this doesn't work in REPL. See "Locals are per-chunk" here: https://github.com/bakpakin/Fennel/blob/master/tutorial.md#g...
Thanks, that makes sense. I will also try making it a global value assuming global works in the online REPL.