EGL packages

An EGL package is a container of EGL parts, each of which has a name that is unique to the package. For example, a program and a data item of the same name cannot be in the same package. In general terms, the package is a namespace, which is a container in which the immediately subordinate names are unique.

The package corresponds to a set of subfolders in a directory. The subfolders correspond to the package name.

Package names

A package name is a sequence of names with intervening periods (.). Here is an example:
com.myOrg.myPkg
Each name is that of a subfolder in a hierarchy. The hierarchy for the current example is expressed as follows on a Windows platform:
com\myOrg\myPkg

The EGL parts are in files in the bottommost subfolder; here, the myPkg subfolder.

You might invert the list of qualifiers in your company's Internet domain name and assign the resulting list to the start of your package names. For example, if the domain name is mycompany.mydivision.mydepartment.com, you might start your package names with com.mydepartment.mydivision.mycompany. This convention is often used, and a benefit is that your packages will be unique even if your company merges or collaborates with another.

Package names are case sensitive; myPkg is different from MYpkg.

Although a package corresponds to a set of subfolders, an EGL package is a collection of parts. The subfolders and related files represent only how those parts are stored.

Package statement

Each EGL source file in a named package must start with a statement that identifies the package. The statement provides a kind of documentation, as in the following example:
package myPkg;

Default package

An Eclipse project includes a default package, which is a package that has no name. Other packages cannot access the parts that are defined in a default package. It is generally recommended that you not use a default package because doing so limits the future use of your code by other code.

When you use a default package, the directory that contains the package includes all the EGL source files that are in that package. In this case, a source file does not start with a package statement.