Name resolution in an expression

A name in an EGL expression can refer to any of the following:

The name resolution process is the same no matter where the expression is located (the expression might be in an assignment statement, a function call, or other position). The rules for resolving a part name are different; see EGL part resolution rules.

To resolve a name in an expression, EGL looks at the following declarations, in order:
  1. Current® variables. These are the variables declared within the current function. This includes the parameter list for the function, and any record variable names (but not field names within those records). No duplicate names are allowed in this category.
  2. Current I/O objects. These are I/O objects and other fields specific to the current function. I/O objects might include an array of SQL records referenced in a get statement. At the same level are fields in record variables that are declared or passed as parameters to the function. Record variables declared at the current function level are found in step 1; record variables declared at the program level are found in this step. It is possible to have duplicate names in this category.

    For example, two record variables might be based on the same CustomerRecord definition, each with a customerNumber field. In this case, you must qualify the name customerNumber with the name of the record variable to prevent ambiguity.

    Another example might be a program-level record variable and a function-level field with the same name. In this case, take one or more of the following actions:
    • Qualify the name of the program-level record variable with the this keyword.
    • Set the allowUnqualifiedItemReferences property to YES.
    • Qualify the field with the name of the data table or structured record that contains it. Field names in non-structured records must always be qualified with the record name.
  3. Program-global variables. These are the variables declared outside a function. They include any record variable names (but not field names in those records). No duplicate names are allowed in this category.
  4. Fields. EGL now looks at all fields within the records in steps 3-5. Duplicate names in this category must be qualified to prevent ambiguity.
  5. Library variables. These are the variables in a user library specified in a use declaration. Duplicate names in this category must be qualified with the name of the library.
  6. System variables. Finally EGL looks at the variables in the EGL system libraries. There are no duplicate names in this category.

Feedback