Writing a Wayland Compositor in Zig - Isaac Freund
Zig SHOWTIME4 HN recommenders · recommended in 3 months, 2021–2021
talk · intermediate · 2021–2021 on HN
Isaac Freund, author of the River Wayland compositor, talks about writing a Wayland compositor in Zig. He covers why he chose Zig over C and Rust and how Zig can wrap a hairy C library.
HN recommends it as a phenomenal talk on Zig's C interop and on choosing between C, Rust and Zig for systems work.
Up next
1 mo on HNComparing Tesla, Ford, & VW's Electrical Architectures
Munro Live
1 HN recommend · 2021–2021
8 mo on HNBreaking the x86 Instruction Set
Black Hat
9 HN recommender · 2017–2022
6 mo on HNVladimir Pozner: How the United States Created Vladimir Putin
Yale University
10 HN recommender · 2020–2023
8 mo on HNBlockchains Are a Bad Idea (James Mickens)
HBS Digital Initiative
8 HN recommender · 2018–2023
10 mo on HNThe Real Story Behind Wayland and X - Daniel Stone (linux.conf.au 2013)
Mladen Mijatov
13 HN recommender · 2013–2026
9 mo on HNThe Century of the Self - Part 1: "Happiness Machines"
JustAdamCurtis
13 HN recommender · 2017–2025
10 mo on HNHow to Do 90% of What Plugins Do (With Just Vim)
thoughtbot
10 HN recommender · 2016–2025
4 mo on HNRoss's Game Dungeon: Deus Ex
Accursed Farms
4 HN recommender · 2017–2024
11 mo on HNCppCon 2015: Andrei Alexandrescu “std::allocator...”
CppCon
7 HN recommender · 2017–2025
12 mo on HNLexical Scanning in Go - Rob Pike
GoogleFOSSSydney
13 HN recommender · 2012–2025
10 mo on HNCppCon 2017: Matt Kulukundis “Designing a Fast, Efficient, Cache-friendly Hash Table, Step by Step”
CppCon
9 HN recommender · 2018–2026
9 mo on HNRustConf 2018 - Closing Keynote - Using Rust For Game Development by Catherine West
Rust Programming Language
9 HN recommender · 2018–2023
5 comments from Hacker News
Congratulations! And welcome Isaac, I loved his Zig+Wayland screencast [1], where he explained very engagingly how Zig is able to embrace and extend a pretty hairy C library and make it more memory safe, without forcing the implementor to rewrite or painfully try to bend it to the strict or idiosyncratic rules of the language, as it may happen with Rust or even Go. I can't wait for 1.0! Or at least until the docs are a bit more accessible... :) 1: ▶ this video
this talk is phenomenal thank you. he explains (timestamp: ▶ this video ) why he didn't go with Rust and it's quite puzzling what he says. I don't know enough about Rust if that's the case. To rephrase: "Rust was an obvious contender but it lacked good support for wlroots. there was a project which attempted to address this but they gave up after 12 months of work and 1000 commits. Rust's strong safety guarantees and memory management conflict with wlroots which assumes a longer lifetime of pointers. If you unplug your monitor with wlroots this pointer receives an event that means the output has disappeared and needs to be validated (see here link ).* This is strange because Rust positions itself as a system language so I'd have imagined these scenarios are all over the place and unsafe Rust would be the way most of this is solved?
Rust does not bind well with C for this reason it can not become a system level programming link However, there is another programming language that does not need bindings. It is called Zig and here it explains how it solves the same problem ▶ this video
The author of River has also done some fantastic talks, on Zig ShowTime [1] and at FOSDEM '21 [2]. [1] "Writing a Wayland Compositor in Zig" - ▶ this video [2] "Zig: the perfect language for a Wayland Compositor?" - link
Another Wayland compositor written in Zig is ifreund/river [1]. Isaac, the author, gave a talk on choosing C vs Rust vs Zig on Zig SHOWTIME a while back [2] and also has an upcoming talk at FOSDEM 21 [3] [1] link [2] ▶ this video [3] link