Ken Irving - 2007-01-25

I struggled a little bit with this problem: how to call another method from within the code of an object method.  The two cases I considered are 1) calling methods of the same object, and 2) calling methods of contained objects.

An object method's scope is limited to viewing its own (hidden strore) directory.  If, when I invoke a method, the hidden store path is saved in variable "self", then a contained object could be invoked by a shell command with the tob.sh (or other) object handler or enabler.  The same goes for the object's own methods.  However, there's one key difference; the self variable points explicitly to the object's hidden store, and it's reasonable to be able to identify and call any of the methods of the object. But a contained object might actually be an alias to somewhere else, so there's no way for the self object to directly "see" the contained object's methods.

That is instead handled by the tob program, and using it provides a simple and sufficient solution, though not necessarily optimal.  The object's own methods, on the other hand, might instead be directly called as:

    exec $self/method args...

as there's little point in having tob redo all the work to just arrive at the path contained in self.

For a while I was thinking I could stay within perl in my module code, as that's how I'd implemented a method.  But then I realized that other methods could be coded in any other language, so this just isn't reasonable.

It would be reasonable, however, to implement the tob.sh functionality in a library within a given language, so that the resolving could be done within the process rather than shelled out.  Of course the method call, which might then be done as above, directly calling the method, must be executed (somehow) by the shell, or at least the OS using exec, etc.