caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Stephane Glondu <glondu@crans.org>
To: Charles Bouillaguet <Charles.Bouillaguet@crans.org>
Cc: caml-list@yquem.inria.fr, DooMeeR <romain.bardou@wanadoo.fr>
Subject: Re: [Caml-list] Recursive Variant problem..
Date: Mon, 15 May 2006 17:09:07 +0900	[thread overview]
Message-ID: <44683723.1060206@crans.org> (raw)
In-Reply-To: <A4840FB4-9473-4B6C-8BB3-B10D7AA72B76@crans.org>

Charles Bouillaguet wrote:
> I would like to write a type which describe some kind of term in a toy 
> programming language. It has sets, but not sets of sets
> [...]
> a) is it possible to write that with polymorphic variants, and how ?
> b) Is it possible to wrote that with Recursive modules, and how ?

It reminds me of the following:

------------------------------------------------------------------------
** Norman Ramsey asked and Jacques Garrigue answered:

  > I'm trying to write a small, extensible interpreter, and I'd like to
  > use polymorphic variants as the extension mechanism.  But I'm getting
  > stuck on very simple things.  For example, I would like the value
type
  > to include a few simple values, but I would also like it to be
  > extensible, thus:
  >
  >   type value = [ `Nil
  >                | `Number   of float
  >                | `String   of string
  >                | `Function of [>value] list -> [>value]
  >                | `Table    of ([>value], [>value]) Hashtbl.t
  >                ]
  >
  > However, when I do this, the compiler complains that
  >
  >   The type constructor value is not yet completely defined
  >
  > Is there some way to define a recursive, *extensible* type using
  > polymorphic variants?

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.

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

I haven't read the papers yet, so I cannot go further.

> I'm CC-ing my classmate Romain (Hi, Romain !), as he may be interested...

And what about me? :-(

-- 
Stephane Glondu
ENS de Cachan, currently visiting Keio Universty (Tokyo)


  reply	other threads:[~2006-05-15  8:07 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-14 12:22 Charles Bouillaguet
2006-05-15  8:09 ` Stephane Glondu [this message]
2006-05-15 11:23 ` [Caml-list] " Jacques Garrigue
2006-05-15 12:40   ` Jacques Garrigue

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=44683723.1060206@crans.org \
    --to=glondu@crans.org \
    --cc=Charles.Bouillaguet@crans.org \
    --cc=caml-list@yquem.inria.fr \
    --cc=romain.bardou@wanadoo.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).