|Navigation: Clarion.Net (Clarion#) > Clarion# Language Extensions > Compiler Directives >====== NAMESPACE (declare a scope) ======|
NAMESPACE identifier [,GLOBALCLASS (name)]
|NAMESPACE||declare a program element's scope|
|identifier||A string that identifies the NAMESPACE. Quotes around the string name are not required. Parenthesis are optional.|
|GLOBALCLASS||Set explicit name of global class|
|name||A string constant that identifies the name of the global class.|
The NAMESPACE compiler directive is used to declare a scope within the .NET framework. This scope lets you organize code and gives you a way to create globally-unique types. Namespaces are used both as an “internal” organization system for a program, and as an “external” organization system ' a way of presenting program elements that are exposed to other programs.
You cannot name an object (FILEs, CLASSes, QUEUEs, GROUPs, data types, etc.) that uses the same name as the containing identifier. The compiler will post a CLA0185 error (Identifier is already defined).
NAMESPACE can be placed only in the global data section after the PROGRAM statement in the program source files, or in the local static data section after a MEMBER statement in the member source files.
You can use namespace directive in included files (see INCLUDE directive). In this case the directive must be first statement in the included file.
If a MEMBER module doesn't contain a NAMESPACE directive, then the PROGRAM module's namespace is used for the MEMBER module.
All global declarations of a namespace are translated as members of special global class. By default the name of the global class is Global<;name of source file>. You can set the name of global class explicitly with GLOBALCLASS attribute. The use of GLOBALCLASS is optional, and is seldom used or required.
See Also: USING (reference a namespace)