From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id RAA21465 for caml-redistribution; Mon, 5 Oct 1998 17:52:46 +0200 (MET DST) Received: (from xleroy@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id RAA32214; Mon, 5 Oct 1998 17:11:58 +0200 (MET DST) 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 RAA14997; Mon, 5 Oct 1998 17:11:56 +0200 (MET DST) Received: from mad.unice.fr (mad.unice.fr [134.59.10.81]) by nez-perce.inria.fr (8.8.7/8.8.7) with ESMTP id RAA22753; Mon, 5 Oct 1998 17:11:54 +0200 (MET DST) Received: from math.unice.fr (fantino@localhost [127.0.0.1]) by mad.unice.fr (8.8.7/8.8.7) with ESMTP id RAA00493; Mon, 5 Oct 1998 17:10:08 +0200 Sender: weis Message-ID: <3618E14F.217B0EE1@math.unice.fr> Date: Mon, 05 Oct 1998 16:10:07 +0100 From: Serge Fantino Organization: Organization X-Mailer: Mozilla 4.05 [en] (X11; I; Linux 2.0.35 i686) MIME-Version: 1.0 To: caml-list@inria.fr CC: Vyskocil Vladimir , caml-light@inria.fr Subject: porté des définitions des variables de classe Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Ocaml-2.0 autorise la déclaration de classe suivante: class test = object val v = [|Random.int 1000|] method get = v.(1) method set x = v.(1)<-x end Bizarrement, les objets créés à partir de cette définition semblent tous partager la meme variable v: let a = new test;; let b = new test;; a#get;; b#get;; (* retourne la meme valeur *) a#set (Random.int 1000);; a#get;; b#get;; (* a et b sont tous les 2 modifiés *) Si l'on déclare la classe différement: class test () = ... alors tout redevient "normal". Est-ce que c'est un bug ? Ou est-ce une nouvelle fonctionnalitée ? Serge Fantino