technomancy

Joined 19 years ago

Karma
3,634
Submissions
1,362
Member since
Feb 21
Hacker-errant, design and sell DIY keyboard kits: http://atreus.technomancy.us

Coding in Clojure, Fennel, and Lua.

View on Hacker News

Recent submissions

Comment · 6 years ago
If the root problem with QMK is that there are too many moving parts, adding a completely new language and compiler into the mix seems like a step in the wrong direction.

The extra features that QMK has and Menelaus doesn't aren't really all that appealing to me to begin with.

Comment · 6 years ago
MicroPython would not work; a basic hello world in MicroPython takes 3x more memory than the total amount of RAM of the atmega32u4.
Comment · 6 years ago
The docs for using QMK are pretty good, but trying to actually understand the code made my head spin; that's why I decided to write my own firmware. Right now it doesn't have any of the fancy features of QMK, but it currently clocks in at under 200 lines, so I have a suspicion it'd be easier to implement those features from scratch in Microscheme than understand their current implementation in QMK.
Comment · 6 years ago
Thanks; the title is fine. The current link is probably a better starting point; I've added links to the most recent revision so folks can see the final product if they want.
Comment · 6 years ago
Comment · 6 years ago
Comment · 7 years ago
Comment · 7 years ago
Comment · 8 years ago
There are a few factors at play that make a language good to learn: simplicity, learning materials, and suitability for learning projects.

On the first point, Fennel is simpler than any other lisp I know, beyond "my first interpreter" type Schemes. But you'll find much better learning materials for some other lisps; in particular Racket is exemplary in this regard.

So I would say it comes down to the learning projects you might want to build; this is always the trickiest part of learning any language. If you want to learn by creating a game, Fennel is a great choice. Likewise if you want to extend an existing program that already has Lua support, such as AwesomeWM or Redis. But for most "industrial" type projects that access external APIs or write to existing file formats, you'll have a better time in Racket due to the better library ecosystem.

Comment · 8 years ago
Comment · 8 years ago
I've looked briefly at Lumen. I don't do any JS work, so cross-compiling to JS doesn't really appeal to me personally. I would expect that compiling to two targets would make it more difficult to implement clean, readable compiler output the way Fennel does, but I haven't checked.

The docs for Lumen are a bit sparse, but it looks like it doesn't make globals opt-in or make you flag locals as mutable the way Fennel does. IME calling these things out explicitly makes certain kinds of bugs easier to catch. Fennel also allows for optional arity checks on functions.

I would expect that Lumen's keyword arguments would cause some complication when interoperating with Lua, which doesn't have them. In addition, cross-compiling to both JS and Lua means that it can't seamlessly support multiple return values, which are used pervasively in 3rd-party Lua libraries.

As I mentioned elsewhere, Fennel can run in the browser with Fengari, but it's a very different approach because Fengari includes a full Lua VM. This means there's some overhead to load the VM (~220kb) but once it's loaded you get access to coroutines, which are a much nicer way to code non-blocking functions than callbacks.

But these are just my initial uninformed impressions.

Comment · 8 years ago
Comment · 8 years 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.

Comment · 8 years ago
Fennel is continually tested against mainline Lua 5.1, 5.2, and 5.3 as well as LuaJIT: https://github.com/bakpakin/Fennel/blob/master/Makefile#L6

It works great with Fengari for client-side scripting; in fact this is what we use on the web site for the live REPL. We have run some tests against other obscure implementations such as Luerl and Rembulan but have encountered some bugs in those compilers that need to get addressed before they get integrated into the test suit.

Comment · 8 years ago
This was my game, and I've contributed significantly to newer features in the Fennel compiler; happy to oblige if you have any questions about either.

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton