From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.7 required=5.0 tests=AWL,HTML_10_20,HTML_MESSAGE autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by yquem.inria.fr (Postfix) with ESMTP id 6895BBBC1 for ; Mon, 24 Mar 2008 04:16:52 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ap8DAIK65kfRVYT2c2dsb2JhbACCPDeOJAEMAwQFCRSRIYMo X-IronPort-AV: E=Sophos;i="4.25,544,1199660400"; d="scan'208";a="24111952" Received: from an-out-0708.google.com ([209.85.132.246]) by mail4-smtp-sop.national.inria.fr with ESMTP; 24 Mar 2008 04:16:51 +0100 Received: by an-out-0708.google.com with SMTP id b15so647440ana.102 for ; Sun, 23 Mar 2008 20:16:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:mime-version:content-type; bh=FJEdSu3gLlfgeLfxRYFZLwkzLC3jDMWShrlFSCujJTk=; b=Gkd/75tLtSveaa5777Ac2c2XIY6joBSaWaatJ9+2DNd3Fr/LSFuYP3YuUffllB3fXa/qa8li4Hd4TY1shiIldvxcTqqya53vgQW4EQ7DQ/DDM9Ydqs6wWu3nISkm7nZwU91g29GR4Ffi8DBVooST8wMnRd8kVf1i4U1fbByWo9I= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=message-id:date:from:to:subject:mime-version:content-type; b=eBwc67JJ/zT+/apEjTKrBohQXthKnbvGiKNEf9qPKFXwa4VRgUDKHBJEyEJs7zU4zrSSrHpvwwfPE9RxkNdVZm0KKfEL+Xk2QrKimZudMxeSX/mR1TlLU0GIuq74wguk/GXkJSDQ5QXFzHQ1BBB8X3m//S3kXzRS8pV3kWEXG+I= Received: by 10.100.144.11 with SMTP id r11mr16787057and.75.1206328610719; Sun, 23 Mar 2008 20:16:50 -0700 (PDT) Received: by 10.100.215.4 with HTTP; Sun, 23 Mar 2008 20:16:50 -0700 (PDT) Message-ID: Date: Sun, 23 Mar 2008 23:16:50 -0400 From: "Jacques Le Normand" To: "caml-list caml-list" Subject: recursive types MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_15871_20591093.1206328610682" X-Spam: no; 0.00; recursive:01 recursive:01 node:01 node:01 val:01 val:01 string:02 string:02 jacques:03 loc:03 loc:03 types:05 types:05 simpler:05 simpler:05 ------=_Part_15871_20591093.1206328610682 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline hello again list is it possible to have mutually recursive classes and types? I'm trying to implement the zipper, and this is what I came up with: class type node_wrapper = object method identify : string method get_child_location : location end class virtual nodeable = object(self) method virtual to_node_wrapper : node_wrapper end type path = (nodeable list * location * nodeable list) option and location = Loc of nodeable * path which, of course, doesn't type check a simpler test case would be class a = val b : c end type c = a thanks for all the help so far! --Jacques ------=_Part_15871_20591093.1206328610682 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline hello again list
is it possible to have mutually recursive classes and types? I'm trying to implement the zipper, and this is what I came up with:

class type node_wrapper =
object
  method identify : string
  method get_child_location : location
end

class virtual nodeable =
object(self)
  method virtual to_node_wrapper : node_wrapper
end

type path = (nodeable list * location * nodeable list) option
and location = Loc of nodeable * path


which, of course, doesn't type check


a simpler test case would be

class a =
  val b : c
end

type c = a

thanks for all the help so far!
--Jacques
------=_Part_15871_20591093.1206328610682--