caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Warp" <warplayer@free.fr>
To: "OCaml" <caml-list@inria.fr>
Cc: "Michael Vanier" <mvanier@cs.caltech.edu>
Subject: Re: [Caml-list] class variables?
Date: Fri, 11 Jan 2002 12:40:32 +0100	[thread overview]
Message-ID: <004501c19a94$c79d59e0$7e00a8c0@warp> (raw)
In-Reply-To: <200201102343.g0ANh6706101@orchestra.cs.caltech.edu>

> Hi,
>
> I'm considering using ocaml for a project I'm planning.  I plan to use the
> object-oriented features of ocaml extensively.  I was wondering: is there
> any way to get immutable class fields that are shared by all members of
the
> class?  I was thinking of a list of strings, and I don't want to have to
> have the list duplicated for every instance of the class.

Maybe you can try using 'ref'

let strlist = ref []
...
strlist := ["a";"b";"c"] (* change inner value *)

then you can read what's "inside" strlist using !strlist

Warp

-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr


  reply	other threads:[~2002-01-11 11:43 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-01-10 23:43 Michael Vanier
2002-01-11 11:40 ` Warp [this message]
2002-01-11 18:09 ` Maxence Guesdon
2002-01-11 12:19   ` Alain Frisch
2002-01-11 12:25   ` Andreas Rossberg
2002-01-11 20:39     ` Michael Vanier

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='004501c19a94$c79d59e0$7e00a8c0@warp' \
    --to=warplayer@free.fr \
    --cc=caml-list@inria.fr \
    --cc=mvanier@cs.caltech.edu \
    /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;
as well as URLs for NNTP newsgroup(s).