Description
A namespace is a named element that can own other named elements. Each named element may be owned by at most one namespace. A namespace provides a means for identifying named elements by name. Named elements can be identified by name in a namespace either by being directly owned by the namespace or by being introduced into the namespace by other means e.g. importing or inheriting. Namespace is an abstract metaclass.
Attributes
No additional attributes.
Associations
/ member: NamedElement [*] | A collection of NamedElements identifiable within the Namespace, either by being owned
or by being introduced by importing or inheritance. This is a derived union.
|
/ ownedMember: NamedElement [*] | A collection of NamedElements owned by the Namespace. Subsets Ele
ment::ownedElement and Namespace::member. This is a derived union.
|
membersAreDistinguishable()
Namespace::getNamesOfMember(element: NamedElement): Set(String);
getNamesOfMember =
if member->includes(element) then Set{}->including(element.name) else Set{} endif
Namespace::membersAreDistinguishable() : Boolean;
membersAreDistinguishable =
self.member->forAll( memb |
self.member->excluding(memb)->forAll(other |
memb.isDistinguishableFrom(other, self)))
A namespace provides a container for named elements. It provides a means for resolving composite names, such as name1::name2::name3. The member association identifies all named elements in a namespace called N that can be referred to by a composite name of the form N::<x>. Note that this is different from all of the names that can be referred to unqualified within N, because that set also includes all unhidden members of enclosing namespaces.
Named elements may appear within a namespace according to rules that specify how one named element is distinguishable from another. The default rule is that two elements are distinguishable if they have unrelated types, or related types but different names. This rule may be overridden for particular cases, such as operations which are distinguished by their signature.
Notation
No additional notation. Concrete subclasses will define their own specific notation.