On Nov 13, 2005, at 1:22 AM, Sherm Pendley wrote:
On Nov 12, 2005, at 11:18 PM, Ken Williams wrote:
Yeah, I know, but I posted it because I didn't really like the other
solutions; while they use "better" (and more complicated) techniques,
they won't actually solve the OP's problem. The "pretend you have
methods instead of subroutines" solution is just wishful thinking,
and the "dispatch tables" solution seems overengineered and won't
work unless the specific list of allowed functions (rather than just
a naming-scheme pattern or similar) is known to the dispatcher.
The subroutines have to be known anyway. Unless, of course, you're
going to let the eval() just crash...
So, if one were implementing, say, FORTH, in Perl, intending to allow
the user to compile subroutines of her own, can it be done with
dispatch tables? Can you add entries to dispatch tables at run-time?