[comp.sys.handhelds] A Way to pass variables?

TDSTRONG%MTUS5.BITNET@VM1.NoDak.EDU (Tim Strong) (04/12/91)

Something someone was trying to do with incrementing a local variable
in one program in another got me to thinking about an old technique
I used to use on the 28.  Unfortunately I haven't found a way to make
it do what he wanted but its still neat:

Try the following:

On the command line enter

 0 -> a << HALT

Then press return

Next without KILLing the above HALT make another program or algebraic using
'a' for example:

'2*a^3'  'EQT'  STO

STO it away then press KILL

Now try a new program such as

<< -> a << EQT EVAL >>  'TRYIT'

put a number on the stack an run it.  Notice that the inner program
EQT recognizes the local variable 'a' from the program that called it.
If you don't understand what I mean just quickly VISIT 'EQT' and put
it back unchanged and run 'TRYIT' again.  Notice this time 'a' is no longer
recognized in EQT.

Somebody from HP showed this to us a year or so back.  What happens is
that as long as you are HALTed in a program that has a local variable,
any program or algebraic you create will also be created using that name
as a local, not a global variable.

Maybe this could be used to pass variables

<< (some glorious operation with a)  'a' STO >>

Make it as above with the HALTed program currently going then I believe
you can pass the 'a' back to the orginal program.  This seems like a solution
to the problem of passing variables except one can only pass the variable of
the same name (which stinks).  Anyone think of a better way.  Maybe you
could check with an IF THEN.  {Maybe I'm just babbling to myself and no one
can understand a word of what I'm saying because I'm inept at saying it.}

======================================================================
  ___
  I__)  _   _I  _   _   TIM STRONG <TDSTRONG%MTUS5.BITNET@CUNYVM.EDU>
  I  \ (_I (_I (_I I    MICHIGAN TECH.    HOUGHTON, MICHIGAN

======================================================================