From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 A3BE8BBAF for ; Fri, 5 Feb 2010 22:04:33 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgYBAI8WbEuLEwExgGdsb2JhbACbUAEBCwsKBRUFrTMBjXYFhFI X-IronPort-AV: E=Sophos;i="4.49,415,1262559600"; d="scan'208,217";a="43399093" Received: from infao0809.mpi-sb.mpg.de (HELO hera.mpi-sb.mpg.de) ([139.19.1.49]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/AES256-SHA; 05 Feb 2010 22:04:33 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mpi-sb.mpg.de; s=mail200803; h=Cc:Message-Id:From:To: In-Reply-To:Content-Type:Subject:Mime-Version:Date:References; bh=fznW7681tSgHZU5BQ1hDEnBdSoWgRxMKzsBzp0cive4=; b=Wfj0VNMOECC+9 YdjijQ4uHxRky9xX3lrVPZdrhS+28o48m8iIdVkgXsfngpBHymJ+/LqJUFpztdl/ WN/gjWauUs+5XgduUu9bMYubkbITxRxUZRDLRkrKmFgK/bgaipq5J7omosBU5La1 fo96Y0GBBOzXWTkSWmQrQUzW0WKJI8= Received: from newmaniac.mpi-sb.mpg.de ([139.19.1.26]:45124) by hera.mpi-sb.mpg.de (envelope-from ) with esmtp (Exim 4.69) id 1NdVLp-0000s4-Lp; Fri, 05 Feb 2010 22:04:32 +0100 Received: from f052058011.adsl.alicedsl.de ([78.52.58.11]:49871) by newmaniac.mpi-sb.mpg.de with esmtpsa (TLS-1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.63) (envelope-from ) id 1NdVLp-0003So-2k; Fri, 05 Feb 2010 22:04:29 +0100 Cc: OCaml List Message-Id: <464C6D1A-C030-4319-9C8E-79D499C0CAFC@mpi-sws.org> From: Andreas Rossberg To: Tim Hanson In-Reply-To: <9d2084741002051116y188cbc55t4961e254ed4b72dd@mail.gmail.com> Content-Type: multipart/alternative; boundary=Apple-Mail-1--666140744 Subject: Re: [Caml-list] Classes/objects with internal references to lists of objects of the same type Mime-Version: 1.0 (Apple Message framework v936) Date: Fri, 5 Feb 2010 22:04:27 +0100 References: <9d2084741002051116y188cbc55t4961e254ed4b72dd@mail.gmail.com> X-Mailer: Apple Mail (2.936) X-Spam: no; 0.00; rossberg:01 rossberg:01 val:01 mutable:01 val:01 mutable:01 cheers:01 cheers:01 pads:98 pads:98 wrote:01 wrote:01 andreas:01 andreas:01 caml-list:01 --Apple-Mail-1--666140744 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit On Feb 5, 2010, at 20.16 h, Tim Hanson wrote: > > I'm trying to make two classes that have internal references to > themselves and each other, but can't figure it out. e.g: > ------- > class a_pad = object > val mutable parent_mod = new a_mod > val mutable connnected : 'a_pad list = [] > end > > class a_mod = object > val mutable pads : 'a_pad list = [] > end > ------- Try: class a_pad = object val mutable parent_mod = new a_mod val mutable connected : a_pad list = [] end and a_mod = object val mutable pads : a_pad list = [] end Cheers, /Andreas --Apple-Mail-1--666140744 Content-Type: text/html; charset=US-ASCII Content-Transfer-Encoding: quoted-printable
On Feb 5, 2010, at = 20.16 h, Tim Hanson wrote:

I'm trying to = make two classes that have internal references to
themselves and each = other, but can't figure it out. e.g:
-------
class a_pad =3D = object
= val mutable parent_mod =3D new a_mod
val = mutable connnected : 'a_pad list =3D []
end

class a_mod =3D = object
= val mutable pads : 'a_pad list =3D = []
end
-------

Try:
<= br>
class a_pad = =3D
  object
    val = mutable parent_mod =3D new a_mod
    val = mutable connected : a_pad list =3D = []
  end
and a_mod = =3D
  object
    val = mutable pads : a_pad list =3D = []
  end

Cheers,
/A= ndreas

= --Apple-Mail-1--666140744--