Post Reply 
ids scope
10-14-2016, 07:15 AM
Post: #1
ids scope
I do not understand why dd identifier, can not be called


PHP Code:
local aa:=9// Local external identifier
export bb:=8// Global visible identifier
cc:=7// Global hidden identifier
dir1_fun1( ); // subfunctions
dir1_fun2();

EXPORT main_dir1() // Global main function
BEGIN
  
print(); 
  print(
"aa= " aa); // 9 calls to external local  aa
  
print("bb= " bb); // 8 calls to visible global bb
  
print("cc= " cc); // 7 calls to hidden global bb
  
local aa:=6;        // new scope of aa
  
print("aa= " aa); // 6
  
print("");

  
dir1_fun1(); // 9 5 4 3 2
  
print("");

  print(
"aa= " aa); // 6
  
print("bb= " bb); // 3
  
print("cc= " cc); // 2
 
  //dd:=1; // out of scope ?
  //print("dd= " + dd); 
  
  
dir1_fun2(); 
  
  print(
"ee= " ee); //
  
ee:=-4;
  print(
"ee= " ee); 
END;

export dd:=5// Global visible identifier
dir1_fun1( ) // Local Subfuntion hidden
BEGIN
 
print("aa= " aa); // 9 calls to external local  aa
 
print("dd= " dd); // 5 calls to visible global dd
 
print("-");
 
aa:=4;              // modifies external local aa 9->4
 
print("aa= " aa); // 4
 
bb:=3;              // modifies visible global bb 8->3
 
print("bb= " bb); // 3
 
cc:=2;              // modifies hidden global cc 7->2
 
print("cc= " cc); // 2
END;

export ee:= 0;
export dir1_fun2( ) // Global Subfuntion
BEGIN
  
//export ff:=0; // not valid
  
print("ee= " ee); //
  
ee:=-1;
END

please correct the English commentary
Find all posts by this user
Quote this message in a reply
10-14-2016, 08:08 AM
Post: #2
RE: ids scope
Hello,

The PPL compiler is a single pass compiler. As a result, it requires that things be defined before being used.
This is why you can not use dd in the source code before you define it.
Here, before is not temporal but is with regard to the source code.

Cyrille

Although I work for the HP calculator group, the views and opinions I post here are my own. I do not speak for HP.
Find all posts by this user
Quote this message in a reply
Post Reply 




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