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 NAA13147; Fri, 11 Jan 2002 13:19:33 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id NAA13272 for ; Fri, 11 Jan 2002 13:19:33 +0100 (MET) Received: from nef.ens.fr (nef.ens.fr [129.199.96.32]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id g0BCJWP09803; Fri, 11 Jan 2002 13:19:32 +0100 (MET) Received: from clipper.ens.fr (clipper-gw.ens.fr [129.199.1.22]) by nef.ens.fr (8.10.1/1.01.28121999) with ESMTP id g0BCJVX54798 ; Fri, 11 Jan 2002 13:19:31 +0100 (CET) Received: from localhost (frisch@localhost) by clipper.ens.fr (8.9.2/jb-1.1) id NAA18732 ; Fri, 11 Jan 2002 13:19:31 +0100 (MET) Date: Fri, 11 Jan 2002 13:19:31 +0100 (MET) From: Alain Frisch To: Maxence Guesdon cc: Michael Vanier , Subject: Re: [Caml-list] class variables? In-Reply-To: <20020111130920.338c2a9b.maxence.guesdon@inria.fr> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Fri, 11 Jan 2002, Maxence Guesdon wrote: > *But* if class foo has parameters, then the expressions before the 'objet' keyword are evaluated at > each creation of a new instanciation, so in the following code > > class foo () = > let my_list = [ "foo" ; "bar"] in > object > ... > end > > let t = new foo > let u = new foo > > t and u are two objects which don't share the list my_list. You can write: class foo = let my_list = [ "foo" ; "bar"] in fun () -> object ... end in order to share my_list ... or simply use a value defined outside the scope of the class definition. Alain ------------------- 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