caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Jacques Garrigue <garrigue@math.nagoya-u.ac.jp>
To: nr@eecs.harvard.edu
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] recursive polymorphic variants?
Date: Fri, 19 Aug 2005 06:51:18 +0900 (JST)	[thread overview]
Message-ID: <20050819.065118.03980029.garrigue@math.nagoya-u.ac.jp> (raw)
In-Reply-To: <20050818212744.94BD41EB0C3@labrador.eecs.harvard.edu>

From: nr@eecs.harvard.edu (Norman Ramsey)

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

Jacques Garrigue


  reply	other threads:[~2005-08-18 21:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-18 21:27 Norman Ramsey
2005-08-18 21:51 ` Jacques Garrigue [this message]
2005-08-20 11:57   ` [Caml-list] " skaller
2005-08-20 13:23   ` Jon Harrop
2005-08-20 13:50     ` Alain Frisch

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=20050819.065118.03980029.garrigue@math.nagoya-u.ac.jp \
    --to=garrigue@math.nagoya-u.ac.jp \
    --cc=caml-list@inria.fr \
    --cc=nr@eecs.harvard.edu \
    /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).