Namespaces

Namespace are the way to organize your code by dividing it into logical parts. Namespaces affect only labels, not macros or any other identifiers. You can define namespace using syntax:

NAMESPACE myns
  ; code...
END

Namespaces can be nested. There are no namespace objects in fact. Namespace is an information for the compiler to make a "namespace path" from labels that are inside it. You can use labels by preceding them with namespace names and . symbol.

; Here you can use ns1.MyLabel
NAMESPACE ns1
  MyLabel:
  ; Here you can use ns1.MyLabel or just MyLabel
  NAMESPACE ns2
    ; Here you can use ns1.MyLabel or just MyLabel
  END
END

Namespace can be ended and continued later:

NAMESPACE ns
  ; ...
END
; ...
NAMESPACE ns
  ; ...
END

You don't have to specify name for the namespace. It can be anonymous namespace. Name for anonymous namespace will consist of random numbers and other characters.

NAMESPACE
  ; ...
END

Label definitions cannot conflict with others in the same level (redefinition) in any upper levels.

lbl:
lbl: ; error!
NAMESPACE ns
  lbl: ; also error!
END