Previous week Up Next week

Hello

Here is the latest Caml Weekly News, for the week of December 02 to 09, 2008.

  1. OCaml version 3.11.0 released.
  2. New language feature in OCaml 3.11
  3. Dormin

OCaml version 3.11.0 released.

Archive: http://groups.google.com/group/fa.caml/browse_thread/thread/ae440d7937df6eef#

Damien Doligez announced:
It is our pleasure to celebrate the 51st birthday of Eric S. Raymond
by releasing OCaml version 3.11.0.

This release brings you many bug fixes and a few much-wanted
features such as dynamic linking in native code (not available
on all architectures, though).  See below for the complete
list of changes from the previous version.

It is available here: http://caml.inria.fr/download.en.html

Please note: at this time it is only available as source and as
binary for Mac OS X on Intel processors.  Other binary versions
will be added to the Web site next week.

Happy hacking,

-- Damien Doligez for the OCaml team.



Objective Caml 3.11.0:
----------------------

(Changes that can break existing programs are marked with a "*"  )

Language features:
- Addition of lazy patterns: "lazy <pat>" matches suspensions whose values,
 after forcing, match the pattern <pat>.
- Introduction of private abbreviation types "type t = private <type-expr>",
 for abstracting the actual manifest type in type abbreviations.
- Subtyping is now allowed between a private abbreviation and its definition,
 and between a polymorphic method and its monomorphic instance.

Compilers:
- The file name for a compilation unit should correspond to a valid
 identifier (Otherwise dynamic linking and other things can fail, and
 a warning is emitted.)
* Revised -output-obj: the output name must now be provided; its
 extension must be one of .o/.obj, .so/.dll, or .c for the
 bytecode compiler. The compilers can now produce a shared library
 (with all the needed -ccopts/-ccobjs options) directly.
- -dtypes renamed to -annot, records (in .annot files) which function calls
 are tail calls.
- All compiler error messages now include a file name and location, for
 better interaction with Emacs' compilation mode.
- Optimized compilation of "lazy e" when the argument "e" is
 already evaluated.
- Optimized compilation of equality tests with a variant constant constructor.
- The -dllib options recorded in libraries are no longer ignored when
 -use_runtime or -use_prims is used (unless -no_auto_link is
 explicitly used).
- Check that at most one of -pack, -a, -shared, -c, -output-obj is
 given on the command line.
- Optimized compilation of private types as regular manifest types
 (e.g. abbreviation to float, float array or record types with only
  float fields).

Native-code compiler:
- New port: Mac OS X / Intel in 64-bit mode (configure with -cc "gcc -m64").
- A new option "-shared" to produce a plugin that can be dynamically
 loaded with the native version of Dynlink.
- A new option "-nodynlink" to enable optimizations valid only for code
 that is never dynlinked (no-op except for AMD64).
- More aggressive unboxing of floats and boxed integers.
- Can select which assembler and asm options to use at configuration time.

Run-time system:
- New implementation of the page table describing the heap (two-level
 array in 32 bits, sparse hashtable in 64 bits), fixes issues with address
 space randomization on 64-bit OS (PR#4448).
- New "generational" API for registering global memory roots with the GC,
 enables faster scanning of global roots.
 (The functions are caml_*_generational_global_root in <caml/memory.h>.)
- New function "caml_raise_with_args" to raise an exception with several
 arguments from C.
- Changes in implementation of dynamic linking of C code:
 under Win32, use Alain Frisch's flexdll implementation of the dlopen
 API; under MacOSX, use dlopen API instead of MacOSX bundle API.
- Programs may now choose a first-fit allocation policy instead of
 the default next-fit.  First-fit reduces fragmentation but is
 slightly slower in some cases.

Standard library:
- Parsing library: new function "set_trace" to programmatically turn
 on or off the printing of a trace during parsing.
- Printexc library: new functions "print_backtrace" and "get_backtrace"
 to obtain a stack backtrace of the most recently raised exception.
 New function "record_backtrace" to turn the exception backtrace mechanism
 on or off from within a program.
- Scanf library: fine-tuning of meta format implementation;
 fscanf behaviour revisited: only one input buffer is allocated for any
 given input channel;
 the %n conversion does not count a lookahead character as read.

Other libraries:
- Dynlink: on some platforms, the Dynlink library is now available in
 native code. The boolean Dynlink.is_native allows the program to
 know whether it has been compiled in bytecode or in native code.
- Bigarrays: added "unsafe_get" and "unsafe_set"
 (non-bound-checking versions of "get" and "set").
- Bigarrays: removed limitation "array dimension < 2^31".
- Labltk: added support for TK 8.5.
- Num: added conversions between big_int and int32, nativeint, int64.
 More efficient implementation of Num.quo_num and Num.mod_num.
- Threads: improved efficiency of mutex and condition variable operations;
 improved interaction with Unix.fork (PR#4577).
- Unix: added getsockopt_error returning type Unix.error.
 Added support for TCP_NODELAY and IPV6_ONLY socket options.
- Win32 Unix: "select" now supports all kinds of file descriptors.
 Improved emulation of "lockf" (PR#4609).

Tools:
- ocamldebug now supported under Windows (MSVC and Mingw ports),
 but without the replay feature.  (Contributed by Dmitry Bely
 and Sylvain Le Gall at OCamlCore with support from Lexifi.)
- ocamldoc: new option -no-module-constraint-filter to include functions
 hidden by signature constraint in documentation.
- ocamlmklib and ocamldep.opt now available under Windows ports.
- ocamlmklib no longer supports the -implib option.
- ocamlnat: an experimental native toplevel (not built by default).

Camlp4:
* programs linked with camlp4lib.cma now also need dynlink.cma.

Bug fixes:
- Major GC and heap compaction: fixed bug involving lazy values and
 out-of-heap pointers.
- PR#3915: updated most man pages.
- PR#4261: type-checking of recursive modules
- PR#4308: better stack backtraces for "spontaneous" exceptions such as
 Stack_overflow, Out_of_memory, etc.
- PR#4338: Str.global_substitute, Str.global_replace and the Str.*split*
 functions are now tail-recursive.
- PR#4503: fixed bug in classify_float on ARM.
- PR#4512: type-checking of recursive modules
- PR#4517: crash in ocamllex-generated lexers.
- PR#4542: problem with return value of Unix.nice.
- PR#4557: type-checking of recursive modules.
- PR#4562: strange %n semantics in scanf.
- PR#4564: add note "stack is not executable" to object files generated by
 ocamlopt (Linux/x86, Linux/AMD64).
- PR#4566: bug in Ratio.approx_ratio_fix and Num.approx_num_fix.
- PR#4582: clarified the documentation of functions in the String module.
- PR#4583: stack overflow in "ocamlopt -g" during closure conversion pass.
- PR#4585: ocamldoc and "val virtual" declarations.
- PR#4587: ocamldoc and escaped @ characters.
- PR#4605: Buffer.add_substitute was sometime wrong when target string had
          backslashes.
- PR#4614: Inconsistent declaration of CamlCBCmd in LablTk library.
			
Richard Jones then said:
Fedora Rawhide [the experimental/development version of Fedora] has
been completely rebuilt with OCaml 3.11.0, and all library and
application problems that were found have been patched.

List of packages:

 http://cocan.org/fedora#Package_status

You can get Fedora Rawhide from:

 http://fedoraproject.org/wiki/Releases/Rawhide

but you may prefer to use stable Fedora 10 which was released last
week and includes OCaml 3.10.2.

I should have sent upstream any patches that I had to add, but in case
I missed anyone out you can grab the patches we are using from here:

 http://cvs.fedoraproject.org/viewvc/devel/
			

New language feature in OCaml 3.11

Archive: http://groups.google.com/group/fa.caml/browse_thread/thread/544adcf92ac3b490#

Paolo Donadeo asked and Jérémie Dimino answered:
> > - Subtyping is now allowed between a private abbreviation and its definition,
> > and between a polymorphic method and its monomorphic instance.
> 
> Is there anybody who wants to elaborate this with an example,
> especially the second statement, regarding polymorphic methods?

Here is an example for private abbreviation:

,----
| module M : sig
|   type t = private int
|   val x : t
| end = struct
|   type t = int
|   let x = 1
| end
`----

[M.x] can be seen as a value of type [int] by using a coercion:

,----
| # M.x;;
| - : M.t = 1
| # (M.x :> int);;
| - : int = 1
`----

And one example for polymorphic methods:

,----
| class type foo = object
|   method f : int -> int
| end
|
| let x = object
|   method f : 'a. 'a -> 'a = fun x -> x
| end
`----

with ocaml < 3.11 [x] can not be coerced to type [foo]:

,----
| # (x :> foo);;
| Characters 1-2:
|   (x :> foo);;
|    ^
| This expression cannot be coerced to type foo = < f : int -> int >;
| it has type < f : 'a. 'a -> 'a > but is here used with type #foo
| Types for method f are incompatible
`----

but it can with ocaml 3.11:

,----
| # (x :> foo);;
| - : foo = <obj>
`----
			

Dormin

Archive: http://groups.google.com/group/fa.caml/browse_thread/thread/651d3856ac14a393#

malc announced:
Once again, OCaml and LablGL helped to make something not entirely
usual for a functional programming language - another character
animation player, this time for models from Shadow of the Colossus
game. Thanks to Inria, Jacques Garrigue and other LablGL contributors
for making this task that much easier and pleasant.

The code is at:
http://repo.or.cz/w/dormin.git

If you have the game it even make sense to compile and run it, if not
you can take a glimpse at:
http://video.google.com/videoplay?docid=6489317706505311170

P.S. For hump maintainers, APC and IMT have moved and now live at:
    http://repo.or.cz/w/apc.git and http://repo.or.cz/w/imt.git
    respectively.
			

Using folding to read the cwn in vim 6+

Here is a quick trick to help you read this CWN if you are viewing it using vim (version 6 or greater).

:set foldmethod=expr
:set foldexpr=getline(v:lnum)=~'^=\\{78}$'?'&lt;1':1
zM

If you know of a better way, please let me know.


Old cwn

If you happen to miss a CWN, you can send me a message and I'll mail it to you, or go take a look at the archive or the RSS feed of the archives.

If you also wish to receive it every week by mail, you may subscribe online.


Alan Schmitt