call procedure named in a variable? 
Author Message
 call procedure named in a variable?

Is there a way to do meta programming so I can do something like

variable = foo
call variable
...
foo: procedure
etc.
Thanks for any insight

--
Michael Appelmans
//  remove C A P S to mail



Sat, 09 Nov 2002 03:00:00 GMT  
 call procedure named in a variable?
Quote:

> Is there a way to do meta programming so I can do something like

> variable = foo

Interpret "call" variable

Would execute the clause "call FOO", if there is no variable named foo.

Regards, Johnnie



Sat, 09 Nov 2002 03:00:00 GMT  
 call procedure named in a variable?

Quote:

> Is there a way to do meta programming so I can do something like

> variable = foo
> call variable
> ...
> foo: procedure
> etc.
> Thanks for any insight

> --
> Michael Appelmans
> //  remove C A P S to mail


Hello Michael,

use "interpret" like in the following example :

/* */
main:
 fakesub = realsub
 interpret call fakesub
return

realsub:
 say 'sub called'
return

--
Bye/2
Meinolf



Sat, 09 Nov 2002 03:00:00 GMT  
 call procedure named in a variable?
On Tue, 23 May 2000 15:52:49 -0400, "Michael Appelmans"

Quote:

>Is there a way to do meta programming so I can do something like

>variable = foo
>call variable
>...
>foo: procedure
>etc.
>Thanks for any insight

>--
>Michael Appelmans
>//  remove C A P S to mail


If you mean can "foo" be declared within an "interpret" statement the
answer is no which is a real pain!

Bye
Dennis



Mon, 11 Nov 2002 03:00:00 GMT  
 call procedure named in a variable?

In Object REXX you can use

        variable = foo
        call (variable)
        ....
        foo: procedure
        etc.

In Classic REXX you've to use the interpret statement for this purpose.



Mon, 11 Nov 2002 03:00:00 GMT  
 call procedure named in a variable?
| Johnnie Hougaard Nielsen entertained comp.lang.rexx with the following
story:
| >> Is there a way to do meta programming so I can do something like
| >> variable = foo
| >Interpret "call" variable
| >Would execute the clause "call FOO", if there is no variable named foo.
|
| See also:
|
| variable = 'FOO'
| call multiway variable, arg1, arg2
| ...
| multiway: procedure
| parse arg label
| signal value label
|
| foo: parse arg , arg1, arg2
| /* etc */
---[snipped]---
_______________________________________________________
This assumes that   "FOO"    is an internal subroutine and not
external  (or built-in).

Gerard S.



Tue, 12 Nov 2002 03:00:00 GMT  
 call procedure named in a variable?
Johnnie Hougaard Nielsen entertained comp.lang.rexx with the following story:

Quote:

>> Is there a way to do meta programming so I can do something like
>> variable = foo
>Interpret "call" variable
>Would execute the clause "call FOO", if there is no variable named foo.

See also:

variable = 'FOO'
call multiway variable, arg1, arg2

...

multiway: procedure
parse arg label
signal value label

foo: parse arg , arg1, arg2
/* etc */

Look, no INTERPRET :o)
--

------ http://users.comlab.ox.ac.uk/ian.collier/imc.shtml

New to this group?  Answers to frequently-asked questions can be had from
http://rexx.hursley.ibm.com/rexx/ .



Wed, 13 Nov 2002 03:00:00 GMT  
 call procedure named in a variable?

Quote:
>Look, no INTERPRET :o)

I _knew_ it was possible!  (Les Koehler showed me but I forgot.)


Wed, 13 Nov 2002 03:00:00 GMT  
 call procedure named in a variable?
And in NetRexx?


Quote:

> In Object REXX you can use

> variable = foo
> call (variable)
> ....
> foo: procedure
> etc.

> In Classic REXX you've to use the interpret statement for this purpose.



Fri, 15 Nov 2002 03:00:00 GMT  
 call procedure named in a variable?

Quote:

>And in NetRexx?

Use reflection (see java.lang.reflect).
--

Team OS/2
http://www.multimania.com/lafaix


Fri, 15 Nov 2002 03:00:00 GMT  
 
 [ 10 post ] 

 Relevant Pages 

1. Calling a procedure with a variable procedure name

2. Start with a variable procedure name.

3. Procedure name in a string variable

4. Is there a variable for procedure name

5. using variables to create a procedure name

6. can procedure name be variable.

7. Using a variable name for a variable name??

8. Name of calling procedure

9. printing the name of the calling procedure

10. Calling a procedure using a variable

11. Calling a procedure from a variable

12. Updating window variables from called procedure

 

 
Powered by phpBB® Forum Software