CommunityNews

CommunityNews

I rewrote my Rust keyboard firmware in Zig: consistency, mastery, and fun

I’ve spent the last year building keyboards, which has included writing firmware for a variety custom circuit boards.

I initially wrote this firmware in Rust, but despite years of experience with that language I still struggled quite a bit. I eventually got my keyboards working, but it took an embarrassingly long time and wasn’t fun.

After repeated suggestions from my much more Rust-and-computing-experienced friend Jamie Brandon, I rewrote the firmware in Zig, which turned out swimmingly.

I found this quite surprising, given that I’d never seen Zig before and it’s a pre-1.0 language written by a fellow PDX hipster with basically just a single page of documentation.

The experience went so well, in fact, that I now feel just as likely to turn to Zig (a language I’ve used for a dozen hours) as to Rust (which I’ve used for at least a thousand hours).

This, of course, reflects as much about me and my interests as it does about either of these languages. So I’ll have to explain what I want from a systems programming language in the first place…

https://kevinlynagh.com/rust-zig/

This thread was posted by one of our members via one of our news source trackers.

Most Liked

dimitarvp

dimitarvp

This was an excellent article and I enjoyed reading it several days ago.

However, you can tell right from the start that the author initially picked Rust based on hype alone and didn’t do proper pros/cons analysis. He felt happy with his choice of Zig because it was much better positioned to comply with his requirements for lower-level code that doesn’t tackle memory safety concerns and object lifetimes.

All in all, he eventually made the right choice but in the HN thread some people went as far as to claim that Rust is “bad” which of course it is if you pick it for the work that the author wanted; the Rust book is literally warning against some of his requirements in its intro pages!

So the article is valuable but it attracted some rather preliminary and harsh responses.

Popular Backend topics Top

Scorpil
I dabbled in Phoenix for a while now, but never really got my hands dirty with it right up until now. Apart from the whole framework bein...
New
ErlangSolutions
Interested in a blazingly fast type checker with 25 years of investment, delivered on the BEAM? Check out Caramel, an exciting project fr...
New
First poster: bot
Part 1: Introduction to Postgrest. In Codd, we trust In the field of Computer Science and Engineering, few things come close to the dura...
New
First poster: bot
Julia is a scientific programming language that is free and open source.1 It is a relatively new language that borrows inspiration from l...
New
First poster: bot
Django 3.2 is just around the corner and it’s packed with new features. Django versions are usually not that exciting (it’s a good thing!...
New
First poster: bot
At Grammarly, the foundation of our business, our core grammar engine, is written in Common Lisp. It currently processes more than a thou...
New
First poster: bot
I’ve been more serious about learning Rust recently, after dragging on with passive learning for a while. My first real programming langu...
New
wolf4earth
Louis Pilfold is the creator of the Gleam programming language. He explains what Gleam is and tells us where it came from. He then dives...
New
brainlid
In episode 92 of Thinking Elixir, we talk with Mitchell Hanberg and learn about why he created the alternate Phoenix templating language ...
New
fullstackplus
The Ruby ecosystem is rich with tools that make us developers more productive at what we do. Both Rails and Sinatra have been used to bui...
New

Other popular topics Top

AstonJ
If it’s a mechanical keyboard, which switches do you have? Would you recommend it? Why? What will your next keyboard be? Pics always w...
New
AstonJ
What chair do you have while working… and why? Is there a ‘best’ type of chair or working position for developers?
New
malloryerik
Any thoughts on Svelte? Svelte is a radical new approach to building user interfaces. Whereas traditional frameworks like React and Vue...
New
brentjanderson
Bought the Moonlander mechanical keyboard. Cherry Brown MX switches. Arms and wrists have been hurting enough that it’s time I did someth...
New
AstonJ
Do the test and post your score :nerd_face: :keyboard: If possible, please add info such as the keyboard you’re using, the layout (Qw...
New
Margaret
Hello content creators! Happy new year. What tech topics do you think will be the focus of 2021? My vote for one topic is ethics in tech...
New
Exadra37
I am asking for any distro that only has the bare-bones to be able to get a shell in the server and then just install the packages as we ...
New
New
PragmaticBookshelf
Author Spotlight Erin Dees @undees Welcome to our new author spotlight! We had the pleasure of chatting with Erin Dees, co-author of ...
New
AstonJ
This is a very quick guide, you just need to: Download LM Studio: https://lmstudio.ai/ Click on search Type DeepSeek, then select the o...
New