Anvil | Smiths Smiths | Register Register | Login Login |
Search:
Show links Show tools Show tree | Previous document Next document | njet.org > Anvil > Documentation > Language reference > Statements > Definition statements > Namespaces

Namespaces

Namespaces declare a collection of entities which group together somehow, for instnace, belong to same application or library. Namespaces may contain other namespaces, classes, interfaces, functions, variables and constants, just like modules.

Namespace are incremental so that their contents are united together, as if they would have been declared in single namespace statement.

If name of namespace contains more than one symbol then the possibly non-existing namespaces in between are implicitly declared.

Anvil's libraries are also namespaces, located in ``$$native´´ module. This special module may be used in dynamic, but not with static imports.

When namespace are referred in code, they yield value of ``anvil.runtime.Scope´´.

  namespace :=  
    "namespace" namespace-name 
    "{" 
       ( import 
       | constant  
       | variable  
       | function  
       | namespace  
       | class ) *  
    "}" 
  namespace-name := symbol ( "." symbol )* 
See also  | Import  | Definition statements  | Modules  | Grammar  | <namespace>
Contributes notes:
Add a note
What's new | Anvil