Names

Identifiers are used to give names to several classes of language objects and refer to these objects by name later:

These six name spaces are distinguished both by the context and by the capitalization of the identifier: whether the first letter of the identifier is in lowercase (written lowercase-ident below) or in uppercase (written capitalized-ident).

Naming objects

value-name:
      lowercase-ident
   |  ( operator-name )

operator-name:
      prefix-symbol | infix-symbol | * | = | or | & | :=

cconstr-name:
      capitalized-ident
   |  false
   |  true
   |  [ ]
   |  ( )

ncconstr-name:
      capitalized-ident
   |  ::

typeconstr-name:
      lowercase-ident

label-name:
      lowercase-ident

module-name:
      capitalized-ident

modtype-name:
      ident

As shown above, prefix and infix symbols as well as some keywords can be used as value names, provided they are written between parentheses. Keywords such as '::' and 'false' are also constructor names. The capitalization rules are summarized in the table below.

Name spaceCase of first letter
Valueslowercase
Constructorsuppercase
Type constructorslowercase
Record labelslowercase
Modulesuppercase
Module typesany

Referring to named objects

value-path:
      value-name
   |  module-path . lowercase-ident

cconstr:
      cconstr-name
   |  module-path . capitalized-ident

ncconstr:
      ncconstr-name
   |  module-path . capitalized-ident

typeconstr:
      typeconstr-name
   |  extended-module-path . lowercase-ident

label:
      label-name
   |  module-path . lowercase-ident

module-path:
      module-name
   |  module-path . capitalized-ident

extended-module-path:
      module-name
   |  extended-module-path . capitalized-ident
   |  extended-module-path ( extended-module-path )

modtype-path:
      modtype-name
   |  extended-module-path . ident

A named object can be referred to either by its name (following the usual static scoping rules for names) or by an access path prefix . name, where prefix designates a module and name is the name of an object defined in that module. The first component of the path, prefix, is either a simple module name or an access path name1 . name2..., in case the defining module is itself nested inside other modules. For referring to type constructors or module types, the prefix can also contain simple functor applications (as in the syntactic class extended-module-path above), in case the defining module is the result of a functor application.