@musicmatze @josias @janriemer Go is much more safer than C, for example access out of bounds or dereferencing a null pointer is caught properly with a nice message instead of plain "Segmentation fault" or reading/writing to random data.
Aside: I don't really understand why everyone fights for safety so hard. Do you not trust yourself writing code? Yes, safety features that languages provide are very useful and catch mistakes but it's not really something that is a yes/no question.
When you see yourself fighting the borrow checker this indicates a flaw in the overall design/data structure.
Especially when dealing with graph-like data structures you will run into problems when trying to model your data structure in "the traditional way" (via direct references to struct values).
Instead, try to model it via `Copy`able indices or ids.
They actually do it in the compiler, too, for their AST:
Also see `GraphMap` in `petgraph`:
And if you really can't get around using multi-owner-references, you can use Rc and Arc like @musicmatze mentioned.
A great read on how to model linked lists with it is here:
mastodon.technology is shutting down by the end of 2022. Please migrate your data immediately. This Mastodon instance is for people interested in technology. Discussions aren't limited to technology, because tech folks shouldn't be limited to technology either!