Brought to you by the Easter bunny: Objective Caml version 3.00.
The main novelty in this release is the integration of three important
features from Jacques Garrigue's Objective Label:
- Labeled arguments to functions and classes. Labels help document the
code, especially the interfaces of large libraries.
By default, and for backward compatibility with OCaml 2.0x, labels
are optional and can be omitted at point of call. A compiler flag
selects a more Objective Label-style treatment of labels, where
labels are mandatory, but re-ordering of function arguments based on
their labels is supported.
- Optional arguments to functions and classes. They allow to define
multiple call patterns for functions,
- Polymorphic variants. Unlike Caml's data types, those variant types
need not be declared before use, allow constructor names belonging
to multiple types, and provide a refined type checking.
This release 3.00 also provides the LablTk GUI library (a version of
the CamlTK interface that takes advantage of labeled and optional
arguments to provide a much nicer interface), and the OCamlbrowser
"integrated programming environment" (library browser, type-checking
editor, and interactive Objective Caml shell).
Other novelties of this release include support for exception renaming,
a simplified handling of libraries containing C code (the Caml library
now "remembers" all the C libraries that need to be linked in), and
several new library modules Bigarray, Int32, Int64, Nativeint to
facilitate interfacing with numerical C and Fortran code. A more
detailed list of changes is included below.
As usual, sources, documentation and binaries for various platforms
are available from:
http://caml.inria.fr/ocaml/distrib.html
ftp://ftp.inria.fr/lang/caml-light/
For general info on Objective Caml, see http://caml.inria.fr/ocaml/
- Xavier Leroy, for the Objective Caml team.
Objective Caml 3.00:
--------------------
Language:
- OCaml/OLabl merger:
* Support for labeled and optional arguments for functions and classes.
* Support for variant types (sum types compared by structure).
See tutorial (chapter 2 of the OCaml manual) for more information.
- Syntactic change: "?" in stream error handlers changed to "??".
- Added exception renaming in structures (exception E = F).
- (OCaml 2.99/OLabl users only) Label syntax changed to preserve
backward compatibility with 2.0x (labeled function application
is f ~lbl:arg instead of f lbl:arg). A tool is provided to help
convert labelized programs to OCaml 3.00.
Both compilers:
- Option -labels to select commuting label mode (labels are mandatory,
but labeled arguments can be passed in a different order than in
the definition of the function; in default mode, labels may be omitted,
but argument reordering is only allowed for optional arguments).
- Libraries (.cma and .cmxa files) now "remember" C libraries given
at library construction time, and add them back at link time.
Allows linking with e.g. just unix.cma instead of
unix.cma -custom -cclib -lunix
- Revised printing of error messages, now use Format.fprintf; no visible
difference for users, but could facilitate internationalization later.
- Fixed bug in unboxing of records containing only floats.
- Fixed typing bug involving applicative functors as components of modules.
- Better error message for inconsistencies between compiled interfaces.
Bytecode compiler:
- New "modular" format for bytecode executables; no visible differences
for users, but will facilitate further extensions later.
- Fixed problems in signal handling.
Native-code compiler:
- Profiling support on x86 under FreeBSD
- Open-coding and unboxing optimizations for the new integer types
int32, int64, nativeint, and for bigarrays.
- Fixed instruction selection bug with "raise" appearing in arguments
of strict operators, e.g. "1 + raise E".
- Better error message when linking incomplete/incorrectly ordered set
of .cmx files.
- Optimized scanning of global roots during GC, can reduce total running
time by up to 8% on GC-intensive programs.
Interactive toplevel:
- Better printing of exceptions, including arguments, when possible.
- Fixed rare GC bug occurring during interpretation of scripts.
- Added consistency checks between interfaces and implementations
during #load.
Run-time system:
- Added support for "custom" heap blocks (heap blocks carrying
C functions for finalization, comparison, hashing, serialization
and deserialization).
- Support for finalisation functions written in Caml.
Standard library:
- New modules Int32, Int64, Nativeint for 32-bit, 64-bit and
platform-native integers
- Module Array: added Array.sort, Array.stable_sort.
- Module Gc: added Gc.finalise to attach Caml finalisation functions to
arbitrary heap-allocated data.
- Module Hashtbl: do not bomb when resizing very large table.
- Module Lazy: raise Lazy.Undefined when a lazy evaluation needs itself.
- Module List: added List.sort, List.stable_sort; fixed bug in List.rev_map2.
- Module Map: added mapi (iteration with key and data).
- Module Set: added iterators for_all, exists, filter, partition.
- Module Sort: still here but deprecated in favor of new sorting functions
in Array and List.
- Module Stack: added Stack.top
- Module String: fixed boundary condition on String.rindex_from
- Added labels on function arguments where appropriate.
New libraries and tools:
- ocamlbrowser: graphical browser for OCaml sources and compiled interfaces,
supports cross-referencing, editing, running the toplevel.
- LablTK: GUI toolkit based on TK, using labeled and optional arguments,
easier to use than CamlTK.
- Bigarray: large, multi-dimensional numerical arrays, facilitate
interfacing with C/Fortran numerical code, efficient support for
advanced array operations such as slicing and memory-mapping of files.
Other libraries:
- Bytecode threads: timer-based preemption was broken, works back again;
fixed bug in Pervasives.input_line; exported Thread.yield.
- System threads: several GC / reentrancy bugs fixed in buffered I/O
and Unix I/O; revised Thread.join implementation for strict POSIX
conformance; exported Thread.yield.
- Graphics: added support for double buffering; added, current_x, current_y,
rmoveto, rlineto, and draw_rect.
- Num: fixed bug in Num.float_of_num.
- Str: worked around potential symbol conflicts with C standard library.
- Dbm: fixed bug with Dbm.iter on empty database.
New or updated ports:
- Alpha/Digital Unix: lifted 256M limitation on total memory space
induced by -taso
- Port to AIX 4.3 on PowerPC
- Port to HPUX 10 on HPPA
- Deprecated 680x0 / SunOS port
Macintosh port:
- Implemented the Unix and Thread libraries.
- The toplevel application does not work on 68k Macintoshes; maybe
later if there's a demand.
- Added a new tool, ocamlmkappli, to build an application from a
program written in O'Caml.