I have searched and found some info on this topic but the answers are either confusing or not applicable.
I have something like this:
class Thing (val name:String, val refs:IndexedSeq[Ref])
class Ref (val name:String, val thing:Thing)
Now, I want to say, load in a file, parse it and populate this data structure from it. It being immutable and cyclic, how might one do so?
Also, let's say I do get this data structure populated, now I want to modify it, like change rootThing.refs(3).name, how might one do that?
Thanks for the ideas posted here. At this point, I'm thinking that if one really wants persistent data structures for something like this, to think outside the box and consider what questions client code will need to ask. So instead of thinking of objects and fields, think of queries, indexes and such. To start with, I'm thinking in terms of:
Is there a bidirectional multimap persistent data structure?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…