From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id MAA12321; Fri, 11 Jan 2002 12:43:21 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id MAA12216 for ; Fri, 11 Jan 2002 12:43:20 +0100 (MET) Received: from relay-1m.club-internet.fr (relay-1m.club-internet.fr [195.36.216.170]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id g0BBhKT22303 for ; Fri, 11 Jan 2002 12:43:20 +0100 (MET) Received: from warp (lns02m-10-249.w.club-internet.fr [212.194.21.249]) by relay-1m.club-internet.fr (Postfix) with SMTP id 5CBC016E7; Fri, 11 Jan 2002 12:43:18 +0100 (CET) Message-ID: <004501c19a94$c79d59e0$7e00a8c0@warp> From: "Warp" To: "OCaml" Cc: "Michael Vanier" References: <200201102343.g0ANh6706101@orchestra.cs.caltech.edu> Subject: Re: [Caml-list] class variables? Date: Fri, 11 Jan 2002 12:40:32 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk > 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