Given the following code example
case class Thing(
value: String,
parents: Seq[Thing],
children: Seq[Thing],
)
val x = Thing(
value = "foo",
parents = Seq(y),
children = Seq(),
)
val y = Thing(
value = "bar",
parents = Seq(x),
children = Seq(),
)
errors out because y is not initialized when creating x, is there any way of performing this "circular referencing" without using a secondary data structure such as a hash map to manually create pointers to each object?