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

PragmaticBookshelf
Stop developing web apps with yesterday’s tools. Today, developers are increasingly adopting Clojure as a web-development platform. See f...
New
AstonJ
Currently a hot topic in the BEAM world, let’s start a thread for it (as suggested by @crowdhailer here) :smiley: What are your current...
New
New
AstonJ
Just done a fresh install of macOS Big Sur and on installing Erlang I am getting: asdf install erlang 23.1.2 Configure failed. checking ...
New
ariandanim
Hello, i am facing difficult using webpack when to install within phoenix framework 1.5.7 because the webpack is still version 4.x.x inf...
New
CinderellaMan
Create a cryptocurrency trading bot in Elixir (YouTube videos, ebook pay what you want) <span class="hashtag-icon-placeholder"></span>eli...
New
AstonJ
More cool tech inspired by <span class="hashtag-icon-placeholder"></span>erlang :nerd_face: By combining the fault-tolerance and massiv...
New
kelvinst
I have being some Elixir open-source contributions and side projects. Oh, and I’m doing them on livestreams on my twitch channel, follow ...
New
OvermindDL1
Woooooooo! This is such a huge release for it, and 2 years incoming! In short, the library is now using an updated hyper backend (not j...
New
PragmaticBookshelf
Leverage Elixir and the Nx ecosystem to build intelligent applications that solve real-world problems in computer vision, natural languag...
New

Other popular topics Top

malloryerik
Any thoughts on Svelte? Svelte is a radical new approach to building user interfaces. Whereas traditional frameworks like React and Vue...
New
wolf4earth
@AstonJ prompted me to open this topic after I mentioned in the lockdown thread how I started to do a lot more for my fitness. https://f...
New
AstonJ
I have seen the keycaps I want - they are due for a group-buy this week but won’t be delivered until October next year!!! :rofl: The Ser...
New
Exadra37
Oh just spent so much time on this to discover now that RancherOS is in end of life but Rancher is refusing to mark the Github repo as su...
New
PragmaticBookshelf
“A Mystical Experience” Hero’s Journey with Paolo Perrotta @nusco Ever wonder how authoring books compares to writing articles?...
New
OvermindDL1
Woooooooo! This is such a huge release for it, and 2 years incoming! In short, the library is now using an updated hyper backend (not j...
New
First poster: joeb
The File System Access API with Origin Private File System. WebKit supports new API that makes it possible for web apps to create, open,...
New
AstonJ
Was just curious to see if any were around, found this one: I got 51/100: Not sure if it was meant to buy I am sure at times the b...
New
AstonJ
If you want a quick and easy way to block any website on your Mac using Little Snitch simply… File &gt; New Rule: And select Deny, O...
New
New