4 ms·
> Rust works best with strictly tree-shaped data structures, but event handlers turn trees of widgets into arbitrary webs with possibility of circular reference
by amelius 4y ago
> Rust works best with strictly tree-shaped data structures, but event handlers turn trees of widgets into arbitrary webs with possibility of circular references.
This is also the problem with closures. And why you can't do Haskell/Ocaml style functional programming in Rust.
Rust has the reputation of being fast, but if you force everything into a tree, you are making big compromises from the start.
- tjoff 4y agoI'd argue a GC is an order of magnitude bigger compromise though. And that even before considering performance.
- pjmlp 4y agoOnly when disregarding that many languages with GC capabilities, also offer value types and features for manual memory management.
- deleted 4y ago[deleted]
- amelius 4y agoYes, so use Rust for all your tree-shaped programming problems. And a GC'd language for everything else. I know if you're holding a hammer it's difficult to not see everything as a nail ...
- pjmlp 4y agoExactly, hence why Rust's killer use cases are scenarios where having a GC is a no go option.
- tjoff 4y agoOr, you use a non-GC language for any application where you care about memory (hint, vast majority of applications fall into this category). GC is imo the single biggest mistake in software engineering.
- verdagon 4y agoIn a lot of fields, it's more important to have a codebase that's easier to use and more flexible than a codebase that uses less memory. This is why people opt for GC and why it's such a big benefit.
- tjoff 4y agoI'm not really talking about memory requirements. And I don't see how a GC would make any difference in terms of ease of use or flexibility of a codebase. It is a mindset about memory, but you have to have a mindset about memory anyway so it isn't exactly unique.
- worik 4y agoIt is important to have a code base that an inexperienced programmer can work on. Keeping track of memory is one of the hardest parts of programming in languages like C, a bit easier in C++ (thanks RAII) but still memory leaks are rampant. Rust improves in some aspects, but I do not think it is a language for inexperienced programmers. So where garbage collection pauses are tolerable, and real time performance not an issue, save the money and use garbage collection. I too hate garbage collectors, I want to be in control. But the business case is clear: garbage collected languages are a better choice in a lot, f not most, cases.