type
BaseNode[T] = ref object of RootObj
parent: ParentNode[T]
Leaf[T] = ref object of BaseNode[T]
content: T
ParentNode[T] = ref object of BaseNode[T]
forward: BaseNode[T]
backward: BaseNode[T]
Vertical[T] = ref object of ParentNode[T]
Horizontal[T] = ref object of ParentNode[T]
type
Color = ref object
r,g,b: int
var
forward = new(Leaf[Color])
backward = new(Leaf[Color])
parent = new(Vertical[Color])
forward.content = Color()
backward.content = Color()
parent.forward = forward
forward.parent = parent
parent.backward = backward
backward.parent = parent
echo repr(parent)
echo repr(parent)