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 NAA12981; Fri, 11 Jan 2002 13:25:11 +0100 (MET) 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 NAA06730 for ; Fri, 11 Jan 2002 13:25:10 +0100 (MET) Received: from uni-sb.de (uni-sb.de [134.96.252.33]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id g0BCP9T22954 for ; Fri, 11 Jan 2002 13:25:09 +0100 (MET) Received: from cs.uni-sb.de (cs.uni-sb.de [134.96.252.31]) by uni-sb.de (8.11.6/2001121800) with ESMTP id g0BCP9w19830 for ; Fri, 11 Jan 2002 13:25:09 +0100 (CET) Received: from mail.cs.uni-sb.de (IDENT:8PjXgXSTk7zsUQipdvzNHfQ6sGXOYSpS@mail.cs.uni-sb.de [134.96.254.200]) by cs.uni-sb.de (8.12.1/2001121800) with ESMTP id g0BCP8S29916 for ; Fri, 11 Jan 2002 13:25:08 +0100 (CET) Received: from ps.uni-sb.de (grizzly.ps.uni-sb.de [134.96.186.68]) by mail.cs.uni-sb.de (8.12.1/2001121800) with ESMTP id g0BCP6r21712 for ; Fri, 11 Jan 2002 13:25:07 +0100 (CET) X-Authentication-Warning: email: Host grizzly.ps.uni-sb.de [134.96.186.68] claimed to be ps.uni-sb.de Received: from ps.uni-sb.de (zoidberg.ps.uni-sb.de [134.96.186.121]) by ps.uni-sb.de (8.11.2/8.11.0) with ESMTP id g0BCP6T07108; Fri, 11 Jan 2002 13:25:06 +0100 Message-ID: <3C3ED9A2.3A5EB392@ps.uni-sb.de> Date: Fri, 11 Jan 2002 13:25:06 +0100 From: Andreas Rossberg Organization: =?iso-8859-1?Q?Universit=E4t?= des Saarlandes X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.4.3-12 i686) X-Accept-Language: de, en MIME-Version: 1.0 To: caml-list@inria.fr Subject: Re: [Caml-list] class variables? References: <200201102343.g0ANh6706101@orchestra.cs.caltech.edu> <20020111130920.338c2a9b.maxence.guesdon@inria.fr> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk 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 You probably meant let t = new foo () let u = new foo () > t and u are two objects which don't share the list my_list. Right, but you can push the lambda below the let, much like for function definitions: class foo = let my_list = [ "foo" ; "bar"] in fun arg -> object ... end This should do what Michael wants. - Andreas -- Andreas Rossberg, rossberg@ps.uni-sb.de "Computer games don't affect kids; I mean if Pac Man affected us as kids, we would all be running around in darkened rooms, munching magic pills, and listening to repetitive electronic music." - Kristian Wilson, Nintendo Inc. ------------------- 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