Delegation

You may by now have lost track of how delegation within a compound widget takes place. Perhaps a brief look at the implementation will clarify this. Each eval, configure or bind function call for a widget results in a command addressed to the path of the widget. By redirecting the command to a different path, the instructions may be delegated to the appropriate (component) widget. Delegation occurs, in other words, by directing the commands to the widget's virtual path, which is obtained by the protected function thepath(). In contrast, the function path() delivers the path of the widget's outer component. Indirection takes place by invoking the function self(), which relies on an instance variable {\em _self} that may be set by the redirect function. } \fslide{f-self}{Dereferencing self()}{ } The implementation of thepath() and self() is simply:
  char* thepath() { return self()->path(); }
  widget* self() { return _self?_self->self():this; }
  
Hence, resolving a compound widget's primary inner component relies on simple pointer chasing, which may be applied recursively to an arbitrary depth at acceptable costs.