1. Calling a routine by name
Hi Rob,
Is there a way to call a routine by name using a string?
Example:
procedure exec_mov( atom dest, atom src) ... end procedure
sequence x
x = "exec_mov"
call_proc_byname(x, {0, 1})
This would be a neat way to call procedures, like in an
interpreter application. Instead of using routine_id()
(which is subject to change), we could use the actual
routine name instead, and make it more flexible. That would
eliminate endless if..then..else structures, and allow
things like routine lookup tables and such.
Btw, in Perl you can call a subroutine like this:
sub exec_mov { ... }
$x = 'exec_mov';
&$x; # calls exec_mov()
Cool, huh?
----->Buddy
budmeister1 at juno.com
2. Re: Calling a routine by name
Use this to call a procedure by name:
global procedure my_routine (integer arg1, integer arg2, integer arg3)
.. code ..
end procedure
-- And then you can call it like this:
call_proc (routine_id ("my_routine"), { arg1, arg2, arg3 } )
3. Re: Calling a routine by name
- Posted by J E M <budmeister1 at JUNO.COM>
Aug 20, 1999
-
Last edited Aug 21, 1999
Thanks Ralf :)
I knew there must have been a way to do it,
but I wasn't sure how.
----->Buddy
budmeister1 at juno.com