Hacker News new | ask | show | jobs
by ahartmetz 5 days ago
C vs Rust memory management is maybe a real-world example. malloc and free are simple building blocks, but difficult to use correctly. Rust lifetimes are harder to learn, but easier to use without making any mistakes.

To be fair, garbage collection is an even more sophisticated building block, it just costs RAM and CPU time - and reduces predictability of even non-memory resource usage.

Another one is go error handling (simpler, easier to misuse) vs Rust Result types (more complicated, harder to misuse).

Another one is window resizing in X11 vs Wayland. In X11, if you want to change the window size, you just do it - but it's impossible to perfectly synchronize it between the processes involved, so it looks slightly janky while it's changing. Wayland has a procedure for it, but getting it completely right is easy compared to X11. It looks smooth and consistent while it's changing.