Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Andreas Rossberg <rossberg@mpi-sws.org>
To: Tim Hanson <sideskate@gmail.com>
Cc: OCaml List <caml-list@inria.fr>
Subject: Re: [Caml-list] Classes/objects with internal references to lists of objects of the same type
Date: Fri, 5 Feb 2010 22:04:27 +0100	[thread overview]
Message-ID: <464C6D1A-C030-4319-9C8E-79D499C0CAFC@mpi-sws.org> (raw)
In-Reply-To: <9d2084741002051116y188cbc55t4961e254ed4b72dd@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 586 bytes --]

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


[-- Attachment #2: Type: text/html, Size: 1281 bytes --]

      reply	other threads:[~2010-02-05 21:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-05 19:16 Tim Hanson
2010-02-05 21:04 ` Andreas Rossberg [this message]

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=464C6D1A-C030-4319-9C8E-79D499C0CAFC@mpi-sws.org \
    --to=rossberg@mpi-sws.org \
    --cc=caml-list@inria.fr \
    --cc=sideskate@gmail.com \
    /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