Sophie

Sophie

distrib > Mandriva > 9.1 > ppc > by-pkgid > 19bb6433bb07a8b16410504336791904 > files > 218

ocaml-doc-3.06-5mdk.ppc.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
            "http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>
<HEAD>

<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<META name="GENERATOR" content="hevea 1.06-7 of 2001-11-14">
<TITLE>
 Names
</TITLE>
</HEAD>
<BODY TEXT=black BGCOLOR=white>
<A HREF="manual010.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A>
<A HREF="manual008.html"><IMG SRC ="contents_motif.gif" ALT="Contents"></A>
<A HREF="manual012.html"><IMG SRC ="next_motif.gif" ALT="Next"></A>
<HR>
<TABLE CELLPADDING=0 CELLSPACING=0 WIDTH="100%">
<TR><TD BGCOLOR="#66ff66"><DIV ALIGN=center><TABLE>
<TR><TD><A NAME="htoc61"><B><FONT SIZE=5>6.3</FONT></B></A></TD>
<TD WIDTH="100%" ALIGN=center><B><FONT SIZE=5>Names</FONT></B></TD>
</TR></TABLE></DIV></TD>
</TR></TABLE> <A NAME="s:names"></A>
<BR>
Identifiers are used to give names to several classes of language
objects and refer to these objects by name later:
<UL><LI>
value names (syntactic class <TT><I><FONT COLOR=maroon>value-name</FONT></I></TT>),
<LI>value constructors (constant -- class <TT><I><FONT COLOR=maroon>cconstr-name</FONT></I></TT> -- or
non-constant -- class <TT><I><FONT COLOR=maroon>ncconstr-name</FONT></I></TT>),
<LI>labels (<TT><I><FONT COLOR=maroon>label-name</FONT></I></TT>),
<LI>variant tags (<TT><I><FONT COLOR=maroon>tag-name</FONT></I></TT>),
<LI>type constructors (<TT><I><FONT COLOR=maroon>typeconstr-name</FONT></I></TT>),
<LI>record fields (<TT><I><FONT COLOR=maroon>field-name</FONT></I></TT>),
<LI>class names (<TT><I><FONT COLOR=maroon>class-name</FONT></I></TT>),
<LI>method names (<TT><I><FONT COLOR=maroon>method-name</FONT></I></TT>),
<LI>instance variable names (<TT><I><FONT COLOR=maroon>inst-var-name</FONT></I></TT>),
<LI>module names (<TT><I><FONT COLOR=maroon>module-name</FONT></I></TT>),
<LI>module type names (<TT><I><FONT COLOR=maroon>modtype-name</FONT></I></TT>).
</UL>
These nine 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 <TT><I><FONT COLOR=maroon>lowercase-ident</FONT></I></TT> below) or in
uppercase (written <TT><I><FONT COLOR=maroon>capitalized-ident</FONT></I></TT>). Underscore is considered a
lowercase letter for this purpose.<BR>
<BR>
<A NAME="@manual.kwd0"></A>
<A NAME="@manual.kwd1"></A><BR>
<BR>
<TABLE CELLPADDING=0 CELLSPACING=0 WIDTH="100%">
<TR><TD BGCOLOR="#98ff98"><DIV ALIGN=center><TABLE>
<TR><TD><B>Naming objects</B></TD>
</TR></TABLE></DIV></TD>
</TR></TABLE><BR>
<DIV ALIGN=center><TABLE CELLSPACING=2 CELLPADDING=0>
<TR><TD ALIGN=right NOWRAP>
<TT><I><FONT COLOR=maroon>value-name</FONT></I></TT></TD>
<TD ALIGN=right NOWRAP>::=</TD>
<TD ALIGN=left NOWRAP>
 <TT><I><FONT COLOR=maroon>lowercase-ident</FONT></I></TT></TD>
</TR>
<TR><TD ALIGN=right NOWRAP>&nbsp;</TD>
<TD ALIGN=right NOWRAP>|</TD>
<TD ALIGN=left NOWRAP> <TT><FONT COLOR=blue>(</FONT></TT> <TT><I><FONT COLOR=maroon>operator-name</FONT></I></TT> <TT><FONT COLOR=blue>)</FONT></TT></TD>
</TR>
<TR><TD ALIGN=right NOWRAP>
<TT><I><FONT COLOR=maroon>operator-name</FONT></I></TT></TD>
<TD ALIGN=right NOWRAP>::=</TD>
<TD ALIGN=left NOWRAP>
 <TT><I><FONT COLOR=maroon>prefix-symbol</FONT></I></TT> |  <TT><I><FONT COLOR=maroon>infix-symbol</FONT></I></TT> |  <TT><FONT COLOR=blue>*</FONT></TT> |  <TT><FONT COLOR=blue>=</FONT></TT> |  <TT><FONT COLOR=blue>or</FONT></TT> |  <TT><FONT COLOR=blue>&amp;</FONT></TT> |  <TT><FONT COLOR=blue>:=</FONT></TT></TD>
</TR>
<TR><TD ALIGN=right NOWRAP>
<TT><I><FONT COLOR=maroon>cconstr-name</FONT></I></TT></TD>
<TD ALIGN=right NOWRAP>::=</TD>
<TD ALIGN=left NOWRAP>
 <TT><I><FONT COLOR=maroon>capitalized-ident</FONT></I></TT></TD>
</TR>
<TR><TD ALIGN=right NOWRAP>&nbsp;</TD>
<TD ALIGN=right NOWRAP>|</TD>
<TD ALIGN=left NOWRAP> <TT><FONT COLOR=blue>false</FONT></TT></TD>
</TR>
<TR><TD ALIGN=right NOWRAP>&nbsp;</TD>
<TD ALIGN=right NOWRAP>|</TD>
<TD ALIGN=left NOWRAP> <TT><FONT COLOR=blue>true</FONT></TT></TD>
</TR>
<TR><TD ALIGN=right NOWRAP>&nbsp;</TD>
<TD ALIGN=right NOWRAP>|</TD>
<TD ALIGN=left NOWRAP> <TT><FONT COLOR=blue>[</FONT></TT> <TT><FONT COLOR=blue>]</FONT></TT></TD>
</TR>
<TR><TD ALIGN=right NOWRAP>&nbsp;</TD>
<TD ALIGN=right NOWRAP>|</TD>
<TD ALIGN=left NOWRAP> <TT><FONT COLOR=blue>(</FONT></TT> <TT><FONT COLOR=blue>)</FONT></TT></TD>
</TR>
<TR><TD ALIGN=right NOWRAP>
<TT><I><FONT COLOR=maroon>ncconstr-name</FONT></I></TT></TD>
<TD ALIGN=right NOWRAP>::=</TD>
<TD ALIGN=left NOWRAP>
 <TT><I><FONT COLOR=maroon>capitalized-ident</FONT></I></TT></TD>
</TR>
<TR><TD ALIGN=right NOWRAP>&nbsp;</TD>
<TD ALIGN=right NOWRAP>|</TD>
<TD ALIGN=left NOWRAP> <TT><FONT COLOR=blue>::</FONT></TT></TD>
</TR>
<TR><TD ALIGN=right NOWRAP>
<TT><I><FONT COLOR=maroon>label-name</FONT></I></TT></TD>
<TD ALIGN=right NOWRAP>::=</TD>
<TD ALIGN=left NOWRAP>
 <TT><I><FONT COLOR=maroon>lowercase-ident</FONT></I></TT></TD>
</TR>
<TR><TD ALIGN=right NOWRAP>
<TT><I><FONT COLOR=maroon>tag-name</FONT></I></TT></TD>
<TD ALIGN=right NOWRAP>::=</TD>
<TD ALIGN=left NOWRAP>
 <TT><I><FONT COLOR=maroon>capitalized-ident</FONT></I></TT></TD>
</TR>
<TR><TD ALIGN=right NOWRAP>
<TT><I><FONT COLOR=maroon>typeconstr-name</FONT></I></TT></TD>
<TD ALIGN=right NOWRAP>::=</TD>
<TD ALIGN=left NOWRAP>
 <TT><I><FONT COLOR=maroon>lowercase-ident</FONT></I></TT></TD>
</TR>
<TR><TD ALIGN=right NOWRAP>
<TT><I><FONT COLOR=maroon>field-name</FONT></I></TT></TD>
<TD ALIGN=right NOWRAP>::=</TD>
<TD ALIGN=left NOWRAP>
 <TT><I><FONT COLOR=maroon>lowercase-ident</FONT></I></TT></TD>
</TR>
<TR><TD ALIGN=right NOWRAP>
<TT><I><FONT COLOR=maroon>module-name</FONT></I></TT></TD>
<TD ALIGN=right NOWRAP>::=</TD>
<TD ALIGN=left NOWRAP>
 <TT><I><FONT COLOR=maroon>capitalized-ident</FONT></I></TT></TD>
</TR>
<TR><TD ALIGN=right NOWRAP>
<TT><I><FONT COLOR=maroon>modtype-name</FONT></I></TT></TD>
<TD ALIGN=right NOWRAP>::=</TD>
<TD ALIGN=left NOWRAP>
 <TT><I><FONT COLOR=maroon>ident</FONT></I></TT></TD>
</TR>
<TR><TD ALIGN=right NOWRAP>
<TT><I><FONT COLOR=maroon>class-name</FONT></I></TT></TD>
<TD ALIGN=right NOWRAP>::=</TD>
<TD ALIGN=left NOWRAP>
 <TT><I><FONT COLOR=maroon>lowercase-ident</FONT></I></TT></TD>
</TR>
<TR><TD ALIGN=right NOWRAP>
<TT><I><FONT COLOR=maroon>inst-var-name</FONT></I></TT></TD>
<TD ALIGN=right NOWRAP>::=</TD>
<TD ALIGN=left NOWRAP>
 <TT><I><FONT COLOR=maroon>lowercase-ident</FONT></I></TT></TD>
</TR>
<TR><TD ALIGN=right NOWRAP>
<TT><I><FONT COLOR=maroon>method-name</FONT></I></TT></TD>
<TD ALIGN=right NOWRAP>::=</TD>
<TD ALIGN=left NOWRAP>
 <TT><I><FONT COLOR=maroon>lowercase-ident</FONT></I></TT></TD>
</TR></TABLE></DIV>
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.<BR>
<DIV ALIGN=center><TABLE BORDER=1 CELLSPACING=0 CELLPADDING=1 WIDTH="80%">
<TR><TD ALIGN=center NOWRAP><B>Name space</B></TD>
<TD ALIGN=center NOWRAP><B>Case of first letter</B></TD>
</TR>
<TR><TD ALIGN=left NOWRAP>
Values</TD>
<TD ALIGN=left NOWRAP>lowercase</TD>
</TR>
<TR><TD ALIGN=left NOWRAP>Constructors</TD>
<TD ALIGN=left NOWRAP>uppercase</TD>
</TR>
<TR><TD ALIGN=left NOWRAP>Labels</TD>
<TD ALIGN=left NOWRAP>lowercase</TD>
</TR>
<TR><TD ALIGN=left NOWRAP>Variant tag</TD>
<TD ALIGN=left NOWRAP>uppercase</TD>
</TR>
<TR><TD ALIGN=left NOWRAP>Type constructors</TD>
<TD ALIGN=left NOWRAP>lowercase</TD>
</TR>
<TR><TD ALIGN=left NOWRAP>Record fields</TD>
<TD ALIGN=left NOWRAP>lowercase</TD>
</TR>
<TR><TD ALIGN=left NOWRAP>Classes</TD>
<TD ALIGN=left NOWRAP>lowercase</TD>
</TR>
<TR><TD ALIGN=left NOWRAP>Methods</TD>
<TD ALIGN=left NOWRAP>lowercase</TD>
</TR>
<TR><TD ALIGN=left NOWRAP>Modules</TD>
<TD ALIGN=left NOWRAP>uppercase</TD>
</TR>
<TR><TD ALIGN=left NOWRAP>Module types</TD>
<TD ALIGN=left NOWRAP>any</TD>
</TR></TABLE></DIV><BR>
<I>Note on variant tags:</I> the current implementation accepts
lowercase variant tags in addition to uppercase variant tags, but we
suggest you avoid lowercase variant tags for portability and
compatibility with future OCaml versions.<BR>
<BR>
<TABLE CELLPADDING=0 CELLSPACING=0 WIDTH="100%">
<TR><TD BGCOLOR="#98ff98"><DIV ALIGN=center><TABLE>
<TR><TD><B>Referring to named objects</B></TD>
</TR></TABLE></DIV></TD>
</TR></TABLE><BR>
<DIV ALIGN=center><TABLE CELLSPACING=2 CELLPADDING=0>
<TR><TD ALIGN=right NOWRAP>
<TT><I><FONT COLOR=maroon>value-path</FONT></I></TT></TD>
<TD ALIGN=right NOWRAP>::=</TD>
<TD ALIGN=left NOWRAP>
 <TT><I><FONT COLOR=maroon>value-name</FONT></I></TT></TD>
</TR>
<TR><TD ALIGN=right NOWRAP>&nbsp;</TD>
<TD ALIGN=right NOWRAP>|</TD>
<TD ALIGN=left NOWRAP> <TT><I><FONT COLOR=maroon>module-path</FONT></I></TT> <TT><FONT COLOR=blue>.</FONT></TT> &nbsp;<TT><I><FONT COLOR=maroon>lowercase-ident</FONT></I></TT></TD>
</TR>
<TR><TD ALIGN=right NOWRAP>
<TT><I><FONT COLOR=maroon>cconstr</FONT></I></TT></TD>
<TD ALIGN=right NOWRAP>::=</TD>
<TD ALIGN=left NOWRAP>
 <TT><I><FONT COLOR=maroon>cconstr-name</FONT></I></TT></TD>
</TR>
<TR><TD ALIGN=right NOWRAP>&nbsp;</TD>
<TD ALIGN=right NOWRAP>|</TD>
<TD ALIGN=left NOWRAP> <TT><I><FONT COLOR=maroon>module-path</FONT></I></TT> <TT><FONT COLOR=blue>.</FONT></TT> &nbsp;<TT><I><FONT COLOR=maroon>capitalized-ident</FONT></I></TT></TD>
</TR>
<TR><TD ALIGN=right NOWRAP>
<TT><I><FONT COLOR=maroon>ncconstr</FONT></I></TT></TD>
<TD ALIGN=right NOWRAP>::=</TD>
<TD ALIGN=left NOWRAP>
 <TT><I><FONT COLOR=maroon>ncconstr-name</FONT></I></TT></TD>
</TR>
<TR><TD ALIGN=right NOWRAP>&nbsp;</TD>
<TD ALIGN=right NOWRAP>|</TD>
<TD ALIGN=left NOWRAP> <TT><I><FONT COLOR=maroon>module-path</FONT></I></TT> <TT><FONT COLOR=blue>.</FONT></TT> &nbsp;<TT><I><FONT COLOR=maroon>capitalized-ident</FONT></I></TT></TD>
</TR>
<TR><TD ALIGN=right NOWRAP>
<TT><I><FONT COLOR=maroon>typeconstr</FONT></I></TT></TD>
<TD ALIGN=right NOWRAP>::=</TD>
<TD ALIGN=left NOWRAP>
 <TT><I><FONT COLOR=maroon>typeconstr-name</FONT></I></TT></TD>
</TR>
<TR><TD ALIGN=right NOWRAP>&nbsp;</TD>
<TD ALIGN=right NOWRAP>|</TD>
<TD ALIGN=left NOWRAP> <TT><I><FONT COLOR=maroon>extended-module-path</FONT></I></TT> <TT><FONT COLOR=blue>.</FONT></TT> &nbsp;<TT><I><FONT COLOR=maroon>lowercase-ident</FONT></I></TT></TD>
</TR>
<TR><TD ALIGN=right NOWRAP>
<TT><I><FONT COLOR=maroon>field</FONT></I></TT></TD>
<TD ALIGN=right NOWRAP>::=</TD>
<TD ALIGN=left NOWRAP>
 <TT><I><FONT COLOR=maroon>field-name</FONT></I></TT></TD>
</TR>
<TR><TD ALIGN=right NOWRAP>&nbsp;</TD>
<TD ALIGN=right NOWRAP>|</TD>
<TD ALIGN=left NOWRAP> <TT><I><FONT COLOR=maroon>module-path</FONT></I></TT> <TT><FONT COLOR=blue>.</FONT></TT> &nbsp;<TT><I><FONT COLOR=maroon>lowercase-ident</FONT></I></TT></TD>
</TR>
<TR><TD ALIGN=right NOWRAP>
<TT><I><FONT COLOR=maroon>module-path</FONT></I></TT></TD>
<TD ALIGN=right NOWRAP>::=</TD>
<TD ALIGN=left NOWRAP>
 <TT><I><FONT COLOR=maroon>module-name</FONT></I></TT></TD>
</TR>
<TR><TD ALIGN=right NOWRAP>&nbsp;</TD>
<TD ALIGN=right NOWRAP>|</TD>
<TD ALIGN=left NOWRAP> <TT><I><FONT COLOR=maroon>module-path</FONT></I></TT> <TT><FONT COLOR=blue>.</FONT></TT> &nbsp;<TT><I><FONT COLOR=maroon>capitalized-ident</FONT></I></TT></TD>
</TR>
<TR><TD ALIGN=right NOWRAP>
<TT><I><FONT COLOR=maroon>extended-module-path</FONT></I></TT></TD>
<TD ALIGN=right NOWRAP>::=</TD>
<TD ALIGN=left NOWRAP>
 <TT><I><FONT COLOR=maroon>module-name</FONT></I></TT></TD>
</TR>
<TR><TD ALIGN=right NOWRAP>&nbsp;</TD>
<TD ALIGN=right NOWRAP>|</TD>
<TD ALIGN=left NOWRAP> <TT><I><FONT COLOR=maroon>extended-module-path</FONT></I></TT> <TT><FONT COLOR=blue>.</FONT></TT> &nbsp;<TT><I><FONT COLOR=maroon>capitalized-ident</FONT></I></TT></TD>
</TR>
<TR><TD ALIGN=right NOWRAP>&nbsp;</TD>
<TD ALIGN=right NOWRAP>|</TD>
<TD ALIGN=left NOWRAP> <TT><I><FONT COLOR=maroon>extended-module-path</FONT></I></TT> <TT><FONT COLOR=blue>(</FONT></TT> &nbsp;<TT><I><FONT COLOR=maroon>extended-module-path</FONT></I></TT> <TT><FONT COLOR=blue>)</FONT></TT></TD>
</TR>
<TR><TD ALIGN=right NOWRAP>
<TT><I><FONT COLOR=maroon>modtype-path</FONT></I></TT></TD>
<TD ALIGN=right NOWRAP>::=</TD>
<TD ALIGN=left NOWRAP>
 <TT><I><FONT COLOR=maroon>modtype-name</FONT></I></TT></TD>
</TR>
<TR><TD ALIGN=right NOWRAP>&nbsp;</TD>
<TD ALIGN=right NOWRAP>|</TD>
<TD ALIGN=left NOWRAP> <TT><I><FONT COLOR=maroon>extended-module-path</FONT></I></TT> <TT><FONT COLOR=blue>.</FONT></TT> &nbsp;<TT><I><FONT COLOR=maroon>ident</FONT></I></TT></TD>
</TR>
<TR><TD ALIGN=right NOWRAP>
<TT><I><FONT COLOR=maroon>class-path</FONT></I></TT></TD>
<TD ALIGN=right NOWRAP>::=</TD>
<TD ALIGN=left NOWRAP>
 <TT><I><FONT COLOR=maroon>class-name</FONT></I></TT></TD>
</TR>
<TR><TD ALIGN=right NOWRAP>&nbsp;</TD>
<TD ALIGN=right NOWRAP>|</TD>
<TD ALIGN=left NOWRAP> <TT><I><FONT COLOR=maroon>module-path</FONT></I></TT> <TT><FONT COLOR=blue>.</FONT></TT> &nbsp;<TT><I><FONT COLOR=maroon>lowercase-ident</FONT></I></TT></TD>
</TR></TABLE></DIV><BR>
A named object can be referred to either by its name (following the
usual static scoping rules for names) or by an access path <TT><I><FONT COLOR=maroon>prefix</FONT></I></TT> <TT><FONT COLOR=blue>.</FONT></TT> &nbsp;<TT><I><FONT COLOR=maroon>name</FONT></I></TT>,
where <TT><I><FONT COLOR=maroon>prefix</FONT></I></TT> designates a module and <TT><I><FONT COLOR=maroon>name</FONT></I></TT> is the name of an object
defined in that module. The first component of the path, <TT><I><FONT COLOR=maroon>prefix</FONT></I></TT>, is
either a simple module name or an access path <TT><I><FONT COLOR=maroon>name</FONT></I></TT><SUB><FONT SIZE=2>1</FONT></SUB> <TT><FONT COLOR=blue>.</FONT></TT> &nbsp;<TT><I><FONT COLOR=maroon>name</FONT></I></TT><SUB><FONT SIZE=2>2</FONT></SUB> ...,
in case the defining module is itself nested inside other modules.
For referring to type constructors or module types, the <TT><I><FONT COLOR=maroon>prefix</FONT></I></TT> can
also contain simple functor applications (as in the syntactic class
<TT><I><FONT COLOR=maroon>extended-module-path</FONT></I></TT> above), in case the defining module is the
result of a functor application.<BR>
<BR>
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.

<BR>
<BR>
<HR>
<A HREF="manual010.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A>
<A HREF="manual008.html"><IMG SRC ="contents_motif.gif" ALT="Contents"></A>
<A HREF="manual012.html"><IMG SRC ="next_motif.gif" ALT="Next"></A>
</BODY>
</HTML>