The EGL this keyword is used primarily to access a program-global declaration even if a local declaration has the same name. A secondary use is in a set-values block, where the keyword allows access of a record field at run time even if the field name is also the name of a stereotype field or annotation.
If a local declaration has the same name as the program-global declaration, only the local declaration is visible to the expression; but you can override that rule. To access the program-global declaration, qualify the reference with the keyword this.
program myProgram myString STRING = "From the program-global variable"; function main() myString STRING = "In main"; myFunction(); end function myFunction() myString STRING = "In myFunction"; Syslib.writeStdErr(this.myString); end end
The program displays the phrase “From the program-global variable” at the standard output.