I noticed the other day that RPL has no simple way to evaluate an object via a relative address. What I mean is that there's no way to say "evaluate the object whose address is here +/- some offset." This ability is practically a requirement of creating position-independent code.
It's trivial to evaluate an object using an absolute address - just put the address in the run stream. But when a library wants to call a subroutine, it must do it via an XLIB object which finds the library, gets the command from the hash table and jumps there. This is complex and time consuming. The other ways are via a global identifier or a LAM. Since many HP39gs aplets aren't libraries, they have to resort to a jump table at the beginning of the program. Double yuck.
A solution to this seems simple to me. A "relative pointer" object consisting of a 5 nibble prolog and a 5 nibble relative offset. It's function would be to call the object pointed at by the offset.
I suspect there's a good reason why such a thing doesn't exist, but I can't think of it. Does anyone have any ideas?
Thanks,
Dave