News for hackers. Stuff that matters.
Re:Comparison between Rust and D by frankmcsherry on Saturday June 25, 2016 @03:28PM (#11977616)
> Even a trivial tree is hard to implement in Rust, and the implementation will be severely limited: https://github.com/SimonSapin/rust-forest

I mean, you haven't actually pointed at a trivial tree implementation. The requirement that children be able to navigate to siblings is the issue here (complicating unique ownership by parents).

You could totally do a "trivial tree" as

    struct Tree<T> {
      payload: T,
      children: Vec<Tree<T>>,
    }
which your link even says. You would need a handle to the parent to surf around through siblings, is the limitation.

It's not really clear (to me) that the rctree is really all that complicated; the Rc stuff is there to clarify ownership: for how long should allocated memory stick around. It might just read weirdly due to familiarity, in the same way that D might weird me out.

There are no comments on this comment yet.