Post Reply 
Problems with eval(IdentifierName,#recall)
02-28-2017, 01:11 PM
Post: #5
RE: Problems with eval(IdentifierName,#recall)
(02-28-2017 12:43 PM)Han Wrote:  You delete Home variables using: DelHVars("name") or DelHVars({ "list", "of", "names" });
The purge() command is a CAS command; it will only delete CAS variables

Ok, Han
but if I include the sentence DelHVars({"id0", "id1", "id2"});, the simulator enters an indefinite cycle.

without DelHVars({"id0", "id1", "id2"}); within of the prgm, the EVAL command must first evaluate the local and non-global variables, please try the following

6: goto HOME VIEW
6.1: purge(id0, id1, id2); [ENTER]
6.1a:DelHVars({"id0", "id1", "id2"}); [ENTER]
6.2: Now if you define variables in HOME VIEW
id0:=8; id1:='id0'; id2:='id1';[ENTER] // store id2,id1,id0 in the HOME environment
7: goto CAS VIEW
7.1: RCLidsCAS(); [ENTER] returns [8, 8, id2, id1, id0, 8, 8] Why?

PHP Code:
#cas
    
RCLidsCAS():=
    
begin
        local id0
id1id2;
        
//DelHVars({"id0", "id1", "id2"});
        
print;
        
id0:=8;
        
id1:='id0'// OR id1:=quote(id0);
        
id2:='id1';
        print(
"id2="+id2);wait;                     // "id2='id1'"       ok   id2 -> 'id1'  1 LEVEL
        
print("eval(id2)=" + eval(id2)  ); wait;    // "eval(id2)='id1'"  Why?
        
print(" ");
        print(
"eval(id2,0)=" + eval(id2,0) ); wait// "eval(id2,0)=id2" ok   id2 -> 'id2'  // 0 levels
        
print("eval(id2,1)=" + eval(id2,1) ); wait// "eval(id2,1)=id1" 'id1' Why?
        
print("eval(id2,2)=" + eval(id2,2) ); wait// "eval(id2,2)=id1" 'id1' Why?
        
print("eval(id2,3)=" + eval(id2,3) ); wait// "eval(id2,3)=id1" 'id1' Why?
        
print("eval(id2,4)=" + eval(id2,4) ); wait// "eval(id2,4)=id1" 'id1' Why?
        //sto(9,id2);
        
return( [ id2, eval(id2), eval(id2,0), eval(id2,1), eval(id2,2), eval(id2,3), eval(id2,4) ] ); // [id1,id0,id2,id1,id1,id1,id1] 
    
end;
#end 
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Problems with eval(IdentifierName,#recall) - compsystems - 02-28-2017 01:11 PM



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