You cannot have two identical names in scope at the same time.
However, most identifiers that you can access from another part refer
to an area of memory that is logically inside a container (a generatable
logic part, like a Service). In those cases you can qualify a name
with the name of the enclosing container, using dot syntax. You can
qualify the following identifiers in this way:
- fields within records
- variables or functions within libraries
- parts within packages
For example, if the variable
customerBalance is
in a record variable named
myCustomer, your code
refers to the variable as a field of the record:
myCustomer.customerBalance
If the same identifier is in two scopes, any unqualified reference
to the identifier is a reference to the most local scope. You can
use qualifiers to override that behavior. Consider a service with
a
use declaration to access the library
customerLib.
The service and the library each declare a function named
getCustomer().
You can qualify variable names in the following ways:
- If a function in the program invokes getCustomer() with
no qualifier, EGL calls the local (program) version.
- If you qualify the function name with the name of the library,
EGL calls the function from the library:
customerLib.getCustomer();
- If you preface the part name with the package name (such as customerPackage),
EGL can call the library or data table from a different package, even
though you have not referenced the part in an import statement:
customerPackage.customerLib.getCustomer();
The
package name always qualifies a logic part name and cannot immediately
precede a variable, constant, or function name. A local identifier
can be the same as a library name if the local identifier is in a
different package from the one where the data table or library resides.
To reference the library name, include the package name.
For more information, see Name resolution in an expression.