Namespace

In general, a namespace is a container for a set of identifiers (names), and allows the disambiguation of homonym identifiers residing in different namespaces. Namespaces usually group names based on their functionality.

Naming System
A name in a namespace consists of a namespace identifier and a local name. The namespace name is usually applied as a prefix to the local name.

In Augmented Backus-Naur Form: name = separator

Delegation
Namespaces allow delegation of identifier assignment to multiple name issuing organisation whilst retaining global uniqueness. A central Registration authority registrars the assigned namespace identifiers allocated. Each namespace identifier is allocated to an organisation which is subsequently responsible for the assignment of names in their allocated namespace. This organisation may be a name issuing organisation that assign the names themselves, or another Registration authority which further delegates parts of their namespace to different organisations.

Hierarchy
A naming scheme that allows subdelegation of namespaces to third parties is a hierarchical namespace

A hierarchy is recursive if the syntax for the namespace identifier are the same for each subdelegation. An example of a recursive hierarchy is the Domain name system.

An example of a non-recursive hierarchy are Uniform resource name representing an ISBN 13 number.

Namespace versus Scope
A namespace identifier may provide context (Scope in computer science) to a name, and the terms are sometimes used interchangeably. However, the context of a name may also be provided by other factors, such as the location where it occurs or the syntax of the name.

Namespaces in Programming Languages
For many programming languages, namespace is a context for their identifiers. In an operating system, an example of namespace is a directory. Each name in a directory uniquely identifies one file or subdirectory, but one file may have the same name multiple times.

As a rule, names in a namespace cannot have more than one meaning; that is, different meanings cannot share the same name in the same namespace. A namespace is also called a context, because the same name in different namespaces can have different meanings, each one appropriate for its namespace.

Following are other characteristics of namespaces:
 * Names in the namespace can represent objects as well as concepts, be the namespace a natural or ethnic language, a constructed language, the technical terminology of a profession, a dialect, a sociolect, or an artificial language (e.g., a programming language).
 * In the Java programming language, identifiers that appear in namespaces have a short (local) name and a unique long "qualified" name for use outside the namespace.
 * Some compilers (for languages such as C++) combine namespaces and names for internal use in the compiler in a process called name mangling.

Below is an example of a namespace in C++: