[RPL/2] library in interactive mode
BERTRAND Joël
joel.bertrand at systella.fr
Mer 29 Sep 11:46:36 CEST 2004
DEMAINE Benoit-Pierre a écrit :
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
>
> | TEST
> | <<
> | << X sin >>
> | steq draw
> | >>
> |
> | you cannot execute << X sin >>. In a second time, you can write
> |
> | TEST_2
> | <<
> | << X sin >> 'A' sto
> | A steq draw
> | >>
> |
> | and you can ask why A is not executed. In both cases, the operations on
> | the stack are the same and if you authorize the evaluation of A in the
> | second case, you have to authorize the evaluation of << X sin >> in the
> | first case...
>
> In fact, from what I remember, with HP48,
> << stuff >>
> are always put in the stack, whereas the default action of variable is
> to execute their content;
>
> It is a bit tricky: TEST d work fine on HP48, whereas TEST_2 would not
> because at the call of A, it s content would be executed:
> if you hit << stuff >> in cmd line, it is put in the stack, but if a
> program in stored in a var, and you evaluate the var, then the prog is run.
I know, because if you hit << stuff >> in command line, you use on both
28 and 48 an editor that convert a text sequence into an system object.
If a program evaluates a variable, it always tries to evaluate the
internal object. Thus, if you think you have to evaluate a program
stored in a regular variable (global or local), you have to evaluate in
a first time the variable, and in a second time the contained
expression. Both evaluations are made in evaluation() subroutine and
this subroutine is very difficult to modify because evaluation() is used
by a lot of functions (intrinsic and internal functions). The
modification required to evaluate two times a RPN expression stored in a
regular variable only gives us a deadlock (evaluation() cannot know the
subroutine that calls it and it is impossible to call two time
evaluation() from sequenceur()...). I will try to modify evaluation() in
the next release if it is possible (evaluation() is a very sensitive
function, a little bit recursive, and today, it is stable ;-) ).
Regards,
JKB
Plus d'informations sur la liste de diffusion RPL2