I'm having hard time to get how it should be done, especially the last one. Is there some kind of sequence of arbitrary type references, seq[ref], seq[any]? Or should I just make it with object variant method and put up with impossibility of objects variants to have same field name?
Example of such a setup
type
Node = ref object of RootObj
id: string
Container = ref object of Node
scope: seq[any] ? # or at least seq[Node|Container|View] ?
View = ref object of Node
name: string
initNode: ref any # ?
scope: seq[any] # same
If they are going to contain only Node and derivatives, you may use Node. I think this is what you want
type
Node = ref object of RootObj
id: string
Container = ref object of Node
scope: seq[Node]
View = ref object of Node
name: string
initNode: Node
scope: seq[Node]
This is an example using your code