Here is the latest Caml Weekly News, for the week of February 15 to 22, 2011.
Archive: https://sympa-roc.inria.fr/wws/arc/caml-list/2011-02/msg00101.htmlJacques Garrigue explained:
There has been some excitement about the possibilities of first-class modules. One application is to use them as objects, as is already done in the amthing project (using interesting syntactic sugar). This may interest some people that the relation to objects doesn't stop at the concrete object level: combining them with recursive modules, one can also easily encode classes, with virtual methods and inheritance. The basic idea is to turn classes (or rather "traits") into functors from the final object to a list of methods. Here is a bit of code demonstrating this. This code is rather verbose, but using 3.13 features and amthing syntax it can be made much lighter. Jacques Garrigue (* Signature for points, all methods must be functions *) module type Point = sig val get_x : unit -> int val move : int -> unit end (* The Point class, with state x *) (* Needs to be a functor, to allow creating new state *) module PointF(X : sig end) = struct let x = ref 0 let get_x () = !x let move d = x := !x + d end (* Create a new point *) let new_point () = (module PointF(struct end) : Point) (* Signature for the Show trait *) module type Show = sig val show : unit -> string end (* Implementation for the Show trait *) module ShowF(P : Point) = struct let show () = Printf.sprintf "x = %i" (P.get_x ()) end (* Signature for the ShowPoint class *) module type ShowPoint = sig include Point include Show end (* ShowPoint class *) module ShowPointF(P : ShowPoint) = struct include PointF(P) include ShowF(P) end (* Create a new ShowPoint object, by tying the knot *) let new_showpoint () = let module M = struct module rec SP : ShowPoint = ShowPointF(SP) end in (module M.SP : ShowPoint) (* Play with it *) let sp = new_showpoint () let a = let module SP = (val sp : ShowPoint) in SP.move 2; SP.show () (* One can coerce to a supertype *) let sp_as_p = (module (val sp : ShowPoint) : Point)
Archive: https://sympa-roc.inria.fr/wws/arc/caml-list/2011-02/msg00116.htmlJeffrey Scofield announced:
For those interested in using OpenGL ES from OCaml, I've just made a small update to my LablGLES patches so that they compile and link under the NDK on Android. Thanks to Paul Snively for contributing the Android modifications. Instructions for downloading and building LablGLES are here: http://psellos.com/ocaml/lablgles-build.html Glossary: LablGL is an OCaml interface to OpenGL, created by Jacques Garrigue and others. LablGLES is a set of patches that change LablGL into an interface to OpenGLES rather than OpenGL. OpenGLES is a subset of OpenGL intended for embedded use (in cell phones and the like). Notably, it is supported by iPhone, iPad, and Android devices.
Archive: https://sympa-roc.inria.fr/wws/arc/caml-list/2011-02/msg00118.htmlXavier Clerc announced:
This post announces the 1.1 release of the Kaputt project, whose goal is to provide a comprehensive testing framework for the Objective Caml language. Home page: http://kaputt.x9c.fr Main changes since 1.0: - update for Objective Caml 3.12.0 - new build system (ocamlbuild-based) - assertion builders for data containers - generators for functions (both total and partial) - enumerators for file contents (chars, bytes, lines, and marshalled values) - additional shell commands, and possibility to configure shell syntax - enhanced big array, and big num support - fix for possible non-termination on unsatisfiable precondition - implementation of reduction (to try to produce smaller counterexamples) - bug #51: unportable use of 'which' - bug #57: tests fail on 64-bit platform
Archive: https://sympa-roc.inria.fr/wws/arc/caml-list/2011-02/msg00124.htmlDeep in this thread, Vu Ngoc San said:
incidentally, I've just installed ocaml+SDL on windows Vista and XP, using Mingw and flexlink, and I can compile both bytecode and nativecode. I put up a blog post for this, maybe it can help you (?) http://blogperso.univ-rennes1.fr/san.vu-ngoc/index.php/post/2011/02/20/Ocaml-and-SDL-on-windows
Thanks to Alp Mestan, we now include in the Caml Weekly News the links to the recent posts from the ocamlcore planet blog at http://planet.ocamlcore.org/. OCamlEditor 1.6.0: http://caml.inria.fr/cgi-bin/hump.cgi?contrib=721 Kaputt 1.1: http://caml.inria.fr/cgi-bin/hump.cgi?contrib=675 Kaputt 1.1: https://forge.ocamlcore.org/forum/forum.php?forum_id=773 Not-so-phantom types: http://www.sairyx.org/2011/02/not-so-phantom-types/ Various news: Gentoo package, FAQ, upcoming version, OCaml planet, thanks!: http://odns.tuxfamily.org/2011/02/18/various-news-gentoo-package-faq-upcoming-version-ocaml-planet-thanks/ lablgtk-react: https://forge.ocamlcore.org/projects/lablgtk-react/
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.