The previous section discusses variable scope in EASI, in specific what happens when a local variable has the same name as a global variable. This issue becomes a little more complex when dealing with declarations of different types, for example functions.
Consider the following example, which consists of two script files (MYSCRIPT1.EAS and MYSCRIPT2.EAS), and some function calls from the main EASI window.
MYSCRIPT1.EAS
define function same() return(0) enddefine print same define function same() return(1) enddefine print same local int same same = 2 print same
MYSCRIPT2.EAS
define function same2() return(3) enddefine print same2 global int same2 same = 4 print same2
These scripts are then run from the main EASI window as follows:
EASI>run MYSCRIPT1 0 1 2 EASI>print same 1 EASI>run MYSCRIPT2 3 4 EASI>print same2 4
This code snippet demonstrates some interesting behavior. Firstly, note that using the RUN command will load a function the same way that using the LOAD command does.
Secondly, note that while the scope of a variable can be either local or global, the definition of a function is always global. This is apparent, because in MYSCRIPT1.EAS the function same() was accessible in the main window, whereas the local variable same was not.
Finally, and most importantly, this code snippet demonstrates that function and variable names with can be overwritten with a function or variable of the same name and scope. However, a function or variable has the same scope but a different name, the original will not be overwritten. This feature can be very useful for debugging scripts, so that a script doesn't need to be unloaded every time a small change is made to the script, however if names are not assigned with caution, the results can be undesirable.
When writing script with EASI, one should be very careful when assigning names to any type, including variables, functions, structures, classes and parameters to prevent potential namespace clashes
© PCI Geomatics Enterprises, Inc.®, 2026. All rights reserved.