\section{s:names}{Names}
%HEVEA\cutname{names.html}

Identifiers are used to give names to several classes of language
objects and refer to these objects by name later:
\begin{itemize}
\item value names (syntactic class @value-name@),
\item value constructors and exception constructors (class @constr-name@),
\item labels (@label-name@, defined in section~\ref{sss:labelname}),
\item polymorphic variant tags (@tag-name@),
\item type constructors (@typeconstr-name@),
\item record fields (@field-name@),
\item class names (@class-name@),
\item method names (@method-name@),
\item instance variable names (@inst-var-name@),
\item module names (@module-name@),
\item module type names (@modtype-name@).
\end{itemize}
These eleven 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@).  Underscore is considered a
lowercase letter for this purpose.

\subsubsection*{sss:naming-objects}{Naming objects}
\ikwd{mod\@\texttt{mod}}
\ikwd{land\@\texttt{land}}
\ikwd{lor\@\texttt{lor}}
\ikwd{lxor\@\texttt{lxor}}
\ikwd{lsl\@\texttt{lsl}}
\ikwd{lsr\@\texttt{lsr}}
\ikwd{asr\@\texttt{asr}}

\begin{syntax}
value-name:
        lowercase-ident
      | '(' operator-name ')'
;
operator-name:
        prefix-symbol || infix-op
;
infix-op:
    infix-symbol
  | '*' || '+' || '-' || '-.' || '=' || '!=' || '<' || '>' || 'or' || '||'
    || '&' || '&&' || ':='
  | 'mod' || 'land' || 'lor' || 'lxor' || 'lsl' || 'lsr' || 'asr'
;
constr-name:
        capitalized-ident
;
tag-name:
        capitalized-ident
;
typeconstr-name:
        lowercase-ident
;
field-name:
        lowercase-ident
;
module-name:
        capitalized-ident
;
modtype-name:
        ident
;
class-name:
    lowercase-ident
;
inst-var-name:
    lowercase-ident
;
method-name:
    lowercase-ident
\end{syntax}
See also the following language extension:
\hyperref[s:index-operators]{extended indexing operators}.

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

\begin{tableau}{|l|l|}{Name space}{Case of first letter}
\entree{Values}{lowercase}
\entree{Constructors}{uppercase}
\entree{Labels}{lowercase}
\entree{Polymorphic variant tags}{uppercase}
\entree{Exceptions}{uppercase}
\entree{Type constructors}{lowercase}
\entree{Record fields}{lowercase}
\entree{Classes}{lowercase}
\entree{Instance variables}{lowercase}
\entree{Methods}{lowercase}
\entree{Modules}{uppercase}
\entree{Module types}{any}
\end{tableau}

{\it Note on polymorphic variant tags:\/} the current implementation accepts
lowercase variant tags in addition to capitalized variant tags, but we
suggest you avoid lowercase variant tags for portability and
compatibility with future OCaml versions.

\subsubsection*{sss:refer-named}{Referring to named objects}

\begin{syntax}
value-path:
        [ module-path '.' ] value-name
;
constr:
        [ module-path '.' ] constr-name
;
typeconstr:
        [ extended-module-path '.' ] typeconstr-name
;
field:
        [ module-path '.' ] field-name
;
modtype-path:
        [ extended-module-path '.' ] modtype-name
;
class-path:
        [ module-path '.' ] class-name
;
classtype-path:
        [ extended-module-path '.' ] class-name
;
module-path:
        module-name { '.' module-name }
;
extended-module-path:
        extended-module-name { '.' extended-module-name }
;
extended-module-name:
        module-name { '(' extended-module-path ')' }
\end{syntax}

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 @name_1 '.' name_2 \ldots@,
in case the defining module is itself nested inside other modules.
For referring to type constructors, module types, or class 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.

Label names, tag names, method names and instance variable names need
not be qualified: the former three are global labels, while the latter
are local to a class.
