3 ms·
> not being able to implement certain patterns in safe code (e.g. linked lists) This may be correct for doubly linked lists in the classical implementation, bu
by alpaca128 5y ago
> not being able to implement certain patterns in safe code (e.g. linked lists)
This may be correct for doubly linked lists in the classical implementation, but I've never needed one outside of programming exercises. Trees can be safely implemented in at least 2 ways. Rust is limiting, but usually more in terms of approach, not possibilities. As long as the program isn't interacting with the "unsafe" outside environment it's usually no problem avoiding unsafe blocks completely.
- tick_tock_tick 5y agoehh depends on what you're actually coding one job intrusive doubly-linked list were everywhere and very appropriate while my current job never touch them at all.
- arethuza 5y agoI believe the Linux kernel has its own implementation of doubly-linked lists: https://0xax.gitbooks.io/linux-insides/content/DataStructures/linux-datastructures-1.html https://0xax.gitbooks.io/linux-insides/content/DataStructure... Edit: Not that I know much about the Linux kernel, but I do remember it being used as a counter example when someone stated before that nobody uses doubly-linked lists.
- zozbot234 5y agoRust developers are exploring new safe ownership patterns (such as 'QCell' and 'GhostCell') that should make it feasible to implement double linked lists without unsafety. Not very simple, though: these solutions do come with an inherent tradeoff wrt. lack of modularity.