This section describes the kinds of values that are manipulated by Caml Light programs.
Integer values are integer numbers from -2^{30} to 2^{30}-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^{62} to 2^{62}-1.
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.
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.
String values are finite sequences of characters. The current implementation supports strings containing up to 2^{24} - 6 characters (16777210 characters).
Tuples of values are written (v_1, ..., v_n), standing for the n-tuple of values v_1 to v_n. The current implementation supports tuple of up to 2^{22} - 1 elements (4194303 elements).
Record values are labeled tuples of values. The record value written { label_1 = v_1; ...; label_n = v_n } associates the value v_i to the record label label_i, for i = 1 ... n. The current implementation supports records with up to 2^{22} - 1 fields (4194303 fields).
Arrays are finite, variable-sized sequences of values of the same type. The current implementation supports arrays containing to 2^{22} - 1 elements (4194303 elements).
Variant values are either a constant constructor, or a pair of a non-constant constructor and a value. The former case is written cconstr; the latter case is written ncconstr(v), where v is said to be the argument of the non-constant constructor ncconstr.
The following constants are treated like built-in constant constructors:
Constant | Constructor |
---|---|
false | the boolean false |
true | the boolean true |
() | the ``unit'' value |
[] | the empty list |
The current implementation limits the number of distinct constructors in a given variant type to at most 249.
Functional values are mappings from values to values.
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.