Version française
Home     About     Download     Resources     Contact us    
Browse thread
recursive polymorphic variants?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Jon Harrop <jon@f...>
Subject: Re: [Caml-list] recursive polymorphic variants?
On Thursday 18 August 2005 22:51, Jacques Garrigue wrote:
> Have a look at "Private rows: abstracting the unnamed" and
> "Code reuse through polymorphic variants" at
> http://www.math.nagoya-u.ac.jp/~garrigue/papers/
>
> They both give examples of how to define extensible languages using
> polymorphic variants. The first one relies on an experimental feature
> only available in the CVS version of ocaml.

Excellent papers, thanks.

Firstly, may I ask if there is an ETA on the release of a new OCaml version 
with this added functionality?

Secondly, I've been playing around with a term-level interpreter for a DSL 
and, in particular, have been looking at including O(n log n) patterns as 
well as a the usual linear patterns. I've done this by supplementing the 
usual list and array containers with a built-in set container based upon the 
one in OCaml's stdlib.

As this is a set of values and a value can be a set, there is an obvious 
recursion. I implemented it by cut and pasting the stdlib code into my own 
and altering it to have mutually recursive "value set" and "value" comparison 
functions.

Would your private row types let me do this without cut and pasting the code? 
I can't see how, but I'm hoping. :-)

-- 
Dr Jon D Harrop, Flying Frog Consultancy Ltd.
Objective CAML for Scientists
http://www.ffconsultancy.com/products/ocaml_for_scientists