4 ms·
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] an
by kristoff_it 6y ago
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] https://github.com/ifreund/river https://github.com/ifreund/river
[2] https://www.youtube.com/watch?v=mwrA5IRGpfU https://www.youtube.com/watch?v=mwrA5IRGpfU
[3] https://fosdem.org/2021/schedule/event/zig_wayland/ https://fosdem.org/2021/schedule/event/zig_wayland/
- DyslexicAtheist 6y agothis talk is phenomenal thank you. he explains (timestamp: https://youtu.be/mwrA5IRGpfU?t=330 https://youtu.be/mwrA5IRGpfU?t=330) 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 https://way-cooler.org/blog/2019/04/29/rewriting-way-cooler-in-c.html https://way-cooler.org/blog/2019/04/29/rewriting-way-cooler-...).* 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?
- steveklabnik 6y ago> I'd have imagined these scenarios are all over the place Not as many as you'd imagine, really. The core issue here is that lifetimes are a static validation mechanism. But wlroots has pointers that have a dynamic invalidation mechanism. There have been a few big attempts in systems like this to try and validate everything as statically as possible, and just like you'd imagine, the mis-match leads to pain. Rust absolutely has ways of doing dynamic validation, some including unsafe, as you've noticed. But some folks will try to push the boundaries. And that can often be really good! That's how progress is made. But like any experiment, sometimes it doesn't work out well.
- boudin 6y agoWhat he mentions is wlroot-rs. If you're interested, here's the post from its author about the difficulties faced which lead to stopping development. http://way-cooler.org/blog/2019/04/29/rewriting-way-cooler-in-c.html http://way-cooler.org/blog/2019/04/29/rewriting-way-cooler-i... It was discussed here back then https://news.ycombinator.com/item?id=19778738 https://news.ycombinator.com/item?id=19778738