Language Reference/Namespaces

Namespaces can be used to avoid name clashes, without having to use long strange names. The names in two different namespaces will never clash, but it may be necessary to qualify references with the namespace (or part of it) to resolve ambiguities.

A namespaces are declared and defined implicitly using  'es:

: namespace 

: one of  \   \ 

In short a  is a sequence of lowercase identifiers separated by backslashes.

Namespace Entrances and Regions
Namespace entrances divide source files into namespace regions.

A namespace entrance marks the beginning of a namespace region, which ends at the next namespace entrance or the end of the file.

Every file starts in the root namespace.

Namespace regions are not influenced by #include directives, meaning:
 * Namespace entrances in an #include-file does not change the namespace region in the including file
 * Any file starts in the root namespace (also if it is included inside a namespace region in another file).

Any interface, class and implementation that is meet inside a namespace region belongs to that namespace.

Referencing names in namespaces
If ccc is a class in the namespace xxx\yyy, then the full name of ccc</vp> is \xxx\yyy\ccc</vp>.

The leading backslash indicates that we start from the root namespace.

A class/interface can always be uniquely referenced using its full name.

Open namespaces
The full names are not always convenient and therefore it is possible to use shorter names by opening namespaces.

<ScopeQualification>: one of   <OpenQualification> ...

<OpenQualification>: one of   open <NamespaceIdentifier>\ ...

Opening a namespace is distinguished from opening a class/interface by a trailing backslash.

When a namespace is open that part of a full name can be left out.

Notice that the short name does not start with a backslash; A name starting with a backslash is always a full name.

The namespace that a certain scope (i.e. interface/class/implementation) belongs to is (implicitly) open inside that scope.