Monday, 28 April 2008

Language oriented programming: Term Rewriting

The OCaml Journal just published an article describing term rewriting:

"An interesting and powerful alternative to the conventional term-level interpreter is called term rewriting. Rather than reducing expressions down to values, term rewriting simply evaluates expressions by performing substitutions and the result is another expression. This approach is particularly well suited to computer algebra systems such as Mathematica but is also an underappreciated alternative to dynamically-typed programming languages that can integrate useful features like pattern matching and make techniques like partial specialization far easier. This article describes how a simple term rewriter can be constructed and introduces the concept of private variant type constructors in the process..."

To read this article and more, subscribe to The OCaml Journal today!


OCaml to get Concurrent Garbage Collection

Following our exploits with Microsoft's F# programming language, which inherits a concurrent garbage collector from their excellent common-language run-time (CLR) implementation, we have been wondering if OCaml would ever acquire a concurrent GC of its own. Concurrent garbage collection is tremendously useful in a wide variety of circumstances and is of increasing importance as the world transitions to multicore CPUs for desktop computers. Compared to OCaml, concurrency in F# makes it much easier to spawn interactive visualizations from the top-level, write high performance parallel numerical codes and keep GUI applications fluid.

The developers of OCaml at INRIA in France, led by Xavier Leroy, have long since given up on developing their own concurrent GC for OCaml, famously stating in 2002 that developing their own concurrent GC was "Too complex" and "too hard to debug".

Fortunately, Jane St. Capital (one of the largest industrial users of OCaml) have chosen to fund a "multicore" summer project that aims to provide a basic concurrent garbage collector implementation for OCaml. The team from the Université Pierre et Marie Curie, led by Emmanuel Chailloux, intend to complete this project during the summer of 2008.

We have already written to team to suggest that they might also make their run-time compatible with the excellent LLVM project because this would make it much easier for open source developers to reuse this exciting technology.


Friday, 11 April 2008

Labeled and Optional arguments

The OCaml Journal just published an article describing the use of labeled and optional function arguments:

"The OCaml programming language provides a variety of useful features that are not found in many other functional programming languages. This is why OCaml is widely accepted as a functional language for practical use. Labeled and optional function arguments are two related features that can be used to great effect in simplifying interfaces. This article introduces the syntax required to define and use both labeled and optional arguments in OCaml and describes some pedagogical uses of these features, with references to existing libraries, as well as examining some of the problems often encountered by programmers using these features..."

To read this article and more, subscribe to The OCaml Journal today!