In other dynamic languages, this kind of behavior would be called
duck typing. Imagine we have an object x
that is of some
reference class. This object has a tree structure, and each node
in the tree has a parent and children. However, the methods to
fetch a node's parent or its children may have arbitrary names.
These names are stored in treeSkeleton
's parent_caller
and children_caller
fields. Thus, if x$methods()
refers to x
's children and x$parent_method()
refers
to x
's parent, we could define a treeSkeleton
for
x
by writing treeSkeleton$new(x, 'parent_method', 'methods')
.
treeSkeleton_
The iterators on a treeSkeleton
use the standard definition of
successor, predecessor, ancestor, etc.