1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108
|
<!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">
<TITLE>
Values
</TITLE>
</HEAD>
<BODY >
<A HREF="manual007.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A>
<A HREF="manual009.html"><IMG SRC ="next_motif.gif" ALT="Next"></A>
<A HREF="manual006.html"><IMG SRC ="contents_motif.gif" ALT="Contents"></A>
<HR>
<H2>5.2 Values</H2>
This section describes the kinds of values that are manipulated by
Caml Light programs.<BR>
<BR>
<H3>5.2.1 Base values</H3>
<H4>Integer numbers</H4>Integer values are integer numbers from -2<SUP><FONT SIZE=2>30</FONT></SUP> to 2<SUP><FONT SIZE=2>30</FONT></SUP>-1, that
is -1073741824 to 1073741823. The implementation may support a
wider range of integer values: on 64-bit platforms, the current
implementation supports integers ranging from -2<SUP><FONT SIZE=2>62</FONT></SUP> to 2<SUP><FONT SIZE=2>62</FONT></SUP>-1.<BR>
<BR>
<H4>Floating-point numbers</H4>Floating-point values are numbers in floating-point representation.
The current implementation uses double-precision floating-point
numbers conforming to the IEEE 754 standard, with 53 bits of mantissa
and an exponent ranging from -1022 to 1023.<BR>
<BR>
<H4>Characters</H4>Character values are represented as 8-bit integers between 0 and 255.
Character codes between 0 and 127 are interpreted following the ASCII
standard. The current implementation interprets character codes
between 128 and 255 following the ISO 8859-1 standard.<BR>
<BR>
<H4>Character strings</H4> <A NAME="s:string-val"></A>String values are finite sequences of characters. The current
implementation supports strings containing up to 2<SUP><FONT SIZE=2>24</FONT></SUP> - 6
characters (16777210 characters).<BR>
<BR>
<H3>5.2.2 Tuples</H3>Tuples of values are written (<I>v</I><SUB><FONT SIZE=2>1</FONT></SUB>, ..., <I>v</I><SUB><FONT SIZE=2><I>n</I></FONT></SUB>), standing for the
<I>n</I>-tuple of values <I>v</I><SUB><FONT SIZE=2>1</FONT></SUB> to <I>v</I><SUB><FONT SIZE=2><I>n</I></FONT></SUB>. The current implementation
supports tuple of up to 2<SUP><FONT SIZE=2>22</FONT></SUP> - 1 elements (4194303 elements).<BR>
<BR>
<H3>5.2.3 Records</H3>Record values are labeled tuples of values. The record value written
{ <I>label</I><SUB><FONT SIZE=2>1</FONT></SUB> = <I>v</I><SUB><FONT SIZE=2>1</FONT></SUB>; ...; <I>label</I><SUB><FONT SIZE=2><I>n</I></FONT></SUB> = <I>v</I><SUB><FONT SIZE=2><I>n</I></FONT></SUB> } associates the value
<I>v</I><SUB><FONT SIZE=2><I>i</I></FONT></SUB> to the record label <I>label</I><SUB><FONT SIZE=2><I>i</I></FONT></SUB>, for <I>i</I> = 1 ... <I>n</I>. The current
implementation supports records with up to 2<SUP><FONT SIZE=2>22</FONT></SUP> - 1 fields
(4194303 fields).<BR>
<BR>
<H3>5.2.4 Arrays</H3>Arrays are finite, variable-sized sequences of values of the same
type. The current implementation supports arrays containing to
2<SUP><FONT SIZE=2>22</FONT></SUP> - 1 elements (4194303 elements).<BR>
<BR>
<H3>5.2.5 Variant values</H3>Variant values are either a constant constructor, or a pair of a
non-constant constructor and a value. The former case is written
<I>cconstr</I>; the latter case is written <I>ncconstr</I>(<I>v</I>), where <I>v</I> is said
to be the argument of the non-constant constructor <I>ncconstr</I>.<BR>
<BR>
The following constants are treated like built-in constant
constructors:
<BR>
<BR>
<DIV ALIGN=center>
<TABLE BORDER=1 CELLSPACING=0 CELLPADDING=1 WIDTH="80%">
<TR><TD ALIGN=center NOWRAP><B>Constant</B></TD>
<TD ALIGN=center NOWRAP><B>Constructor</B></TD>
</TR>
<TR><TD ALIGN=left NOWRAP>
<TT>false</TT></TD>
<TD ALIGN=left NOWRAP>the boolean false</TD>
</TR>
<TR><TD ALIGN=left NOWRAP><TT>true</TT></TD>
<TD ALIGN=left NOWRAP>the boolean true</TD>
</TR>
<TR><TD ALIGN=left NOWRAP><TT>()</TT></TD>
<TD ALIGN=left NOWRAP>the ``unit'' value</TD>
</TR>
<TR><TD ALIGN=left NOWRAP><TT>[]</TT></TD>
<TD ALIGN=left NOWRAP>the empty list</TD>
</TR></TABLE></DIV><BR>
The current implementation limits the number of distinct constructors
in a given variant type to at most 249.<BR>
<BR>
<H3>5.2.6 Functions</H3>Functional values are mappings from values to values.<BR>
<BR>
<H3>5.2.7 Objects</H3>Objects are composed of a hidden internal state which is a
record of instance variables, and a set of methods for accessing and
modifying these variables. The structure of an object is described by
the toplevel class that created it.
<BR>
<BR>
<HR>
<A HREF="manual007.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A>
<A HREF="manual009.html"><IMG SRC ="next_motif.gif" ALT="Next"></A>
<A HREF="manual006.html"><IMG SRC ="contents_motif.gif" ALT="Contents"></A>
</BODY>
</HTML>
|