Weekly edition Kernel Security Distributions Contact Us Search Archives Calendar Subscribe Write for LWN LWN.net FAQ Sponsors

# Attn: Development Editor, Latest Caml Weekly News

 From: Alan Schmitt To: lwn , cwn Subject: Attn: Development Editor, Latest Caml Weekly News Date: Tue, 22 Feb 2011 13:10:13 +0100 Message-ID: <34A81239-DFA2-4DA6-B1D1-A0E685702BA4@polytechnique.org> Archive-link: Article, Thread

```Hello,

Here is the latest Caml Weekly News, for the week of February 15 to 22, 2011.

1) Encoding objects using recursive first-class modules
2) LablGLES for Android
3) Kaputt 1.1 release
4) Compiling Windows native code
5) Other Caml News

========================================================================
1) Encoding objects using recursive first-class modules
Archive: <https://sympa-roc.inria.fr/wws/arc/caml-list/2011-02/msg0...>
------------------------------------------------------------------------
** Jacques 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)

========================================================================
2) LablGLES for Android
Archive: <https://sympa-roc.inria.fr/wws/arc/caml-list/2011-02/msg0...>
------------------------------------------------------------------------
** Jeffrey 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.

<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.

========================================================================
3) Kaputt 1.1 release
Archive: <https://sympa-roc.inria.fr/wws/arc/caml-list/2011-02/msg0...>
------------------------------------------------------------------------
** Xavier 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.

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

========================================================================
4) Compiling Windows native code
Archive: <https://sympa-roc.inria.fr/wws/arc/caml-list/2011-02/msg0...>
------------------------------------------------------------------------
** Deep 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/po...>

========================================================================
5) Other Caml News
------------------------------------------------------------------------
** From the ocamlcore planet blog:

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-...>

lablgtk-react:
<https://forge.ocamlcore.org/projects/lablgtk-react/>

========================================================================
Old cwn
------------------------------------------------------------------------

If you happen to miss a CWN, you can send me a message
(alan.schmitt@polytechnique.org) and I'll mail it to you, or go take a look at
the archive (<http://alan.petitepomme.net/cwn/>) or the RSS feed of the
archives (<http://alan.petitepomme.net/cwn/cwn.rss>). If you also wish
to receive it every week by mail, you may subscribe online at
<http://lists.idyll.org/listinfo/caml-news-weekly/> .

========================================================================

```