Given a map-based tree and a key, this returns a child node for the given key, creating it if necessary. This method is called by tree operations like Tree.assign and Dev.copy when copying subtrees.
The behavior of child() is as follows:
If the indicated map node implements the
child()method, this calls that method and returns the result.Otherwise the default behavior is used:
- The map’s
get()method is called. If the value is a map, that’s returned as is. - The map’s constructor is called to create a child map. For this to work, the map’s constructor must not require any arguments.
- The map’s
set()method is called to establish the child map as the value forkey. - The child map is returned.
- The map’s
If the map represents network resources, the default behavior will make consecutive async calls to the network. If greater efficiency is possible, the AsyncMap representing the network storage can implement the child() method, and that method’s implementation will be used instead.