Siblings in the I6 object tree

A quick question on the implementation of siblings in the I6 object tree:

Roger Firth’s Inform 6 FAQ and the DM4 both indicate that each node in the object tree has three pointers: to the parent, the child, and the sibling. The first two are straightforward. However, the sibling pointer seems more fussy. As I understand it, there is an “eldest child” concept, which essentially seems to be the child with a null sibling. The eldest child then points to another sibling, and that sibling to another, etc. Each of these also has a parent pointer back up to the container, as in this diagram from Firth’s FAQ:

This would imply that if I peek at the diamond node, then I will be aware of the certificate but not of the money. This implies that to build a list of the objects that are notional siblings of a given node using the “sibling” link, we would need to traverse the tree at least twice, following links “downstream” from the starting object, but also peeking upstream in case the object I happened to start with isn’t the eldest child. This seems less efficient than looking for any nodes that share the same direct parent. So, what is the purpose of the “sibling” link?

Thanks for any help conceptualizing this! (Note that there is no “how do I?” question here–I am interested in understanding the implementation, not in solving a particular problem.)


The eldest sibling is the one the parent points to as its child. The youngest sibling will be the one with the null sibling reference. It’s probably most straight forward to go up to the parent once, go to its child, and then follow the sibling chain.

Thanks for clearing those things up, I’m not sure how I got that reversed. That search method ought to be a bit more efficient than iterating once over the tree looking for shared parent.

That would depend on how many objects you have. And might be different in glulx and zcode.

Glulx uses the same tree structure. (Although in Glulx the model is entirely up to the compiler, not part of the VM spec.)