Initializing help system before first use

Namespaces

All identifiers (variables and subroutines names) of a program are implicitly collected in a global dictionary shared by the program itself and all packages and modules it uses. It is also possible to group certain identifiers under a namespace that is characterised by a name. A given identifier may appear in several namespaces and each of its occurrences refers to a different entity, as a consequence an entity is unambiguously identified by its name and the namespace to which it is a member: this is the fully qualified name of this entity that is noted:

nspc∼ident

Where nspc is a namespace name and ident an identifier in this namespace.

A namespace's name is also an identifier that must be declared before being used even if it is defined by a package already loaded. This declaration is achieved using the namespace compiler directive:

namespace ns1 [, ns2 ...]

Where nsi are the names of the namespaces that will be used in the program. As an identifier a namespace may be declared as part of another namespace and any of the nsi may have the form nsx∼nsy to declare nsy as a namespace included in nsx. Several namespace directives may be stated.

When the compilation starts a namespace is automatically created: it is used to collect all private symbols of the program. When compiling a model this namespace has an empty name (i.e. a fully qualified name of this namespace is of the form ∼ident) and for a package it has the same name as the package.

When looking for an identifier (that is not fully qualified) the compiler tries first to find it in the global dictionary and then searches in a predefined list of namespaces. This list is initialised with the namespace of private symbols and may be extended using the nssearch directive:

nssearch ns1 [, ns2 ...]

This statement adds the specified namespaces to the search list. If the directive is stated several times, each added list is appended to the current list of namespaces. The namespace search is not recursive: it is not sufficient to add a namespace to the search list to have all its included namespaces to be also part of the search list (e.g. if ns1 includes ns11 and ns12, the 3 names ns1,ns1∼ns11 and ns1∼ns12 must be put into the search list for all the identifiers to be searchable). Note that namespaces listed in a nssearch directive do not need to be declared in a namespace directive.

Any namespace defined in a package is available to any model or package using it (and all the identifiers it includes are implicitly public). Defining a namespace group makes it possible to allow only certain packages to access a given namespace. The definition of such a group requires the use of a dedicated compiler directive:

nsgroup nspc: pkg1 [, pkg2 ...]
or
nsgroup nspc

Where pkgi are the package names (as constant strings) that will be allowed to access namespace nspc. By default the automatic namespace containing the private symbols of a package has a group containing only the package itself such that it cannot be used by any external component. It is however possible to redefine this initial group with a nsgroup directive, in particular the second form of the directive (without specifying any package) makes the corresponding namespace available to any package. Note that namespaces listed in a nsgroup directive do not need to be declared in a namespace directive.

© 2001-2021 Fair Isaac Corporation. All rights reserved. This documentation is the property of Fair Isaac Corporation (“FICO”). Receipt or possession of this documentation does not convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except solely for internal evaluation purposes to determine whether to purchase a license to the software described in this documentation, or as otherwise set forth in a written software license agreement between you and FICO (or a FICO affiliate). Use of this documentation and the software described in it must conform strictly to the foregoing permitted uses, and no other use is permitted.