From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id 19938BCA2 for ; Thu, 18 Aug 2005 23:27:49 +0200 (CEST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j7ILRmNu019789 for ; Thu, 18 Aug 2005 23:27:48 +0200 Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id XAA10950 for ; Thu, 18 Aug 2005 23:27:48 +0200 (MET DST) Received: from mail.eecs.harvard.edu (bowser.eecs.harvard.edu [140.247.60.24]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j7ILRlmS019785 for ; Thu, 18 Aug 2005 23:27:48 +0200 Received: from localhost (localhost.eecs.harvard.edu [127.0.0.1]) by mail.eecs.harvard.edu (Postfix) with ESMTP id CA41434FE6 for ; Thu, 18 Aug 2005 17:27:44 -0400 (EDT) Received: from mail.eecs.harvard.edu ([127.0.0.1]) by localhost (bowser.eecs.harvard.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 00458-04 for ; Thu, 18 Aug 2005 17:27:44 -0400 (EDT) Received: from labrador.eecs.harvard.edu (labrador.eecs.harvard.edu [140.247.60.247]) by mail.eecs.harvard.edu (Postfix) with ESMTP id A38DD34FA2 for ; Thu, 18 Aug 2005 17:27:44 -0400 (EDT) Received: by labrador.eecs.harvard.edu (Postfix, from userid 32074) id 94BD41EB0C3; Thu, 18 Aug 2005 17:27:44 -0400 (EDT) To: caml-list@inria.fr Subject: recursive polymorphic variants? Message-Id: <20050818212744.94BD41EB0C3@labrador.eecs.harvard.edu> Date: Thu, 18 Aug 2005 17:27:44 -0400 (EDT) From: nr@eecs.harvard.edu (Norman Ramsey) X-Virus-Scanned: by EECS Amavis at eecs.harvard.edu X-Miltered: at nez-perce with ID 4304FD54.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at nez-perce with ID 4304FD53.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; recursive:01 variants:01 variants:01 hashtbl:01 compiler:01 recursive:01 polymorphic:01 polymorphic:01 extensible:01 extensible:01 complains:01 constructor:01 define:01 eecs:01 defined:01 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.3 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? Norman