orium / rpds

Rust persistent data structures
Mozilla Public License 2.0
1.22k stars 57 forks source link

Mutable methods for all data structures #14

Closed orium closed 6 years ago

orium commented 6 years ago

These can use {Rc,Arc}::make_mut() that can speed up things a lot if there is not a lot of structural sharing.

Marwes commented 6 years ago

2c

I am not convinced about the split into mut/non-mut structures. Keeping all the methods on a single structure is both simpler to implement and easier to use. The only pro I can see for keeping it separate is that it makes it more explicit when mutating is done, however since Rust already forces the user to be explicit about mutating that is already encoded at the call site.

orium commented 6 years ago

My main motivation for the separation is conceptual (having neat API, separation of two different paradigms). But I have to say that the maintenance burden of doing this separation starts to outweight the conceptual neatness I was looking for. I will follow your suggestion and not split them.