Part-name resolution

The rules for part-name resolution specify the search order that the compiler follows to resolve a part reference; for example, in a variable declaration. The compiler considers the current package directory, the repositories in the EGL build path, and the EGL system package. The compiler stops the search only when the same-named part is found or, if no part is found, only after all locations are searched.

The rest of this description assumes that the compiler is seeking the myPart part in the myPkg package.

Here are the rules:

  1. If the reference is fully qualified, as in the case of myPkg.myPart, the compiler seeks the part in the current directory and then in every repository in the EGL build path. The search through the repositories is in build-path order, which is the order in which the repositories are listed in the eglpath parameter. After reviewing every repository in that list, the search considers the EGL system package.
  2. If the reference is not fully qualified, as in the case of myPart, the compiler gives priority to the following packages, in order:
    1. The package identified in a one-part import statement such as the following:
      import myPkg.myPart; 

      The compiler seeks the part in the current directory; then in every repository in the EGL build path, in build-path order; and then in the EGL system package.

    2. The current package.

      The compiler seeks the part in the current directory and then in every repository in the EGL build path, in build-path order.

    3. The package identified in an on-demand import statement such as the following:
      import myPkg.*; 

      The compiler seeks the part in the current directory and then in every repository in the EGL build path, in build-path order, and then in the EGL system package. The search ends as soon as a part is found. However, if multiple on-demand import statements reference the same part, the search results in an error.