7.3. Namespaces, Packages and Imports
Both Packages and Types are Namespaces, in which every name must be unique. While Types also group elements, their main purpose is to classify and describe things in the domain to be modeled. Packages are only used to group elements for breaking up a large model while avoiding name conflicts. Namespaces can contain other namespaces.
An example of a package is the following:
package Annotations {
metaclass ApprovalAnnotation {
feature approved[1] : Boolean;
feature level[1] : Natural;
}
...
}Imports of either specific or all elements of a package allow using these elements in other namespaces:
private import Annotations::*;
struct System {
@ApprovalAnnotation {approved = true; level = 2;}
...
}Depending on whether an import is public or private, the imported elements are either available or not available in other namespaces importing