Post Reply 
Evaluation of variables in 50g
05-21-2014, 01:30 PM
Post: #4
RE: Evaluation of variables in 50g
I found the answer in the EVAL section of the AUR:

Evaluating a global name causes the following effects:
Quote:Calls the contents of the variable:
• A name is evaluated.
• A program is evaluated.
• A directory becomes the current directory.
• Other objects are put on the stack.
If no variable exists for a given name, evaluating the
name returns the name to the stack.

So the statement
Quote:... the object stored in the corresponding variable is itself evaluated.

is not accurate. Only names, programs and directories are evaluated. I wonder why this specific behavior. Why not EVAL everything? Most objects would push themselves on the stack anyway, and if you don't want it EVAL'd just use 'VAR' RCL instead of VAR. It would be more consistent to have one behavior for all object types.

For example, the function y=x, and y=k*x, written as:
Code:

'x' 'y' STO
or
Code:

'k*x' 'y' STO

Even if we define k=1, then y will return the value of x in one case, or the algebraic 'k*x' in the other. Only if 'x' is undefined it works consistently.
But changing this would wreck most existing code, so I guess we have some thinking to do before making a decision.

Claudio
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Evaluation of variables in 50g - Claudio L. - 05-21-2014 01:30 PM



User(s) browsing this thread: 1 Guest(s)