4 ms·
> (see: http://way-cooler.org/blog/2019/04/29/rewriting-way-cooler-i http://way-cooler.org/blog/2019/04/29/rewriting-way-cooler-i... for how big it is) Disclai
by pengaru 4y ago
> (see: http://way-cooler.org/blog/2019/04/29/rewriting-way-cooler-i http://way-cooler.org/blog/2019/04/29/rewriting-way-cooler-i... for how big it is)
Disclaimer: I don't know Rust beyond println!("Hello World"); C is my preferred language for decades now.
The example Rust code in that linked post is just an absolute unreadable horror show. If that's representative of what it's really like to interop C with Rust or just write real Rust code in general, I'm strongly discouraged from bothering to put more effort into the language.
Can anyone skilled and experienced enough with Rust to judge what's going on there comment? Is the author just a noob making a mess of things as anyone can do in any language, or is this limited to C interop? Or is Rust normally such an inscrutably verbose disaster?
- Filligree 4y agoI've written a bit of Rust/C interop. It doesn't look like that; most of the time it's... not pleasant, since it's interop, but certainly not this terrible. On the other hand, I can't think of a way to do it better either. wlroots might just be uniquely horrible here.
- timidger 4y agoAuthor here. Certainly part of the ugliness of wlroots-rs is my fault (unsafe code + macros is not a fun combination). However, I tried quite a few ways to make this safe and ergonomic. Perhaps some better way exists that I missed, but even if a solution exists the work needed to implement it is very, very boring. wlroots is very much a C API, but I admit I was expecting it to be easier to use from Rust and is my current biggest criticism with the language. Normal Rust is normally not this inscrutable - however it does have a lot of features that could make it as hard to read. It requires a certain amount of discipline that you don't see in simpler languages like Go. I for one never write macros if I can help it anymore.