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.0 required=5.0 tests=AWL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id 4099ABC1A for ; Mon, 24 Mar 2008 04:51:53 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AsoAALbC5kfa1uFijWdsb2JhbACRFwEBAQEJBQcHGJRLBA X-IronPort-AV: E=Sophos;i="4.25,544,1199660400"; d="scan'208";a="8731770" Received: from smtp.syd.people.net.au ([218.214.225.98]) by mail2-smtp-roc.national.inria.fr with SMTP; 24 Mar 2008 04:51:51 +0100 Received: (qmail 10193 invoked from network); 24 Mar 2008 03:51:59 -0000 Received: from unknown (HELO hendrix.mega-nerd.net) (218.214.64.136) by smtp.syd.people.net.au with SMTP; 24 Mar 2008 03:51:59 -0000 Received: from hendrix (hendrix [192.168.200.99]) by hendrix.mega-nerd.net (Postfix) with SMTP id 3CCE3AB1A4 for ; Mon, 24 Mar 2008 14:51:50 +1100 (EST) Date: Mon, 24 Mar 2008 14:51:50 +1100 From: Erik de Castro Lopo To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] recursive types Message-Id: <20080324145150.7f8f986c.mle+ocaml@mega-nerd.com> In-Reply-To: References: Reply-To: caml-list@yquem.inria.fr Organization: Erik Conspiracy Secret Labs X-Mailer: Sylpheed 2.4.5 (GTK+ 2.12.0; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam: no; 0.00; ocaml:01 recursive:01 recursive:01 wrote:01 caml-list:01 int:01 define:02 lisp:02 defined:02 string:02 jacques:03 erik:04 erik:04 types:05 types:05 Jacques Le Normand wrote: > hello again list > is it possible to have mutually recursive classes and types? Yes and yes. I haven't played much with classes at all, but recursive types can be defined as : type x_t = { x : int ; y : y_t ; } and y_t = { z : string } For recursive classes I beleive that you do class xxx = .... and yyy = to define mutually recursive classes xxx and yyy. Erik -- ----------------------------------------------------------------- Erik de Castro Lopo ----------------------------------------------------------------- Think of XML as Lisp for COBOL programmers. -- Tony-A (some guy on /.) -- ----------------------------------------------------------------- Erik de Castro Lopo ----------------------------------------------------------------- "Microsoft treats security vulnerabilities as public relations problems." -- Bruce Schneier