Compilation units (ref) - vilinski/nemerle GitHub Wiki

<< Back to Reference Manual.

compilation_unit = { toplevel_declaration }

A Nemerle program consists of one or more compilation units. Compilation units are text files (conventionally with the .n extension). A compilation unit consists of namespace-related declarations and types within them.

toplevel_declaration =
  'using' Expressions_(ref):qualified_identifier ';'
| 'using' Lexical_structure_(ref):IDENTIFIER '=' qualified_identifier ';'
| 'namespace' qualified_identifier '{' { toplevel_declaration } '}'
| Type_declarations_(ref):type_declaration

The first form adds the specified namespace (which, unlike in C#, can also be a type name) to the symbol search path. Every symbol till end of current namespace or compilation unit (if not within namespace) will be searched also in location specified by this path.

The second form defines an alias for a namespace or type. After using Foo = Bar.Baz; any reference to Foo.bar will be expanded to Bar.Baz.bar.

The namespace declarations puts entities defined inside it within the specified namespace. Namespaces can be nested, creating a tree of namespaces.

⚠️ **GitHub.com Fallback** ⚠️