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 MAA11383 for caml-redistribution; Fri, 27 Mar 1998 12:09:06 +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 SAA15317 for ; Thu, 26 Mar 1998 18:33:02 +0100 (MET) Received: from lorraine.loria.fr (lorraine.loria.fr [152.81.1.17]) by nez-perce.inria.fr (8.8.7/8.8.5) with ESMTP id SAA16778 for ; Thu, 26 Mar 1998 18:33:01 +0100 (MET) Received: from colchen.loria.fr (colchen.loria.fr [152.81.6.137]) by lorraine.loria.fr (8.8.7/8.8.7/8.8.7/JCG) with ESMTP id SAA21347 for ; Thu, 26 Mar 1998 18:32:50 +0100 (MET) Received: from colchen.loria.fr (localhost [127.0.0.1]) by colchen.loria.fr (8.8.2/8.8.2) with SMTP id SAA19946 for ; Thu, 26 Mar 1998 18:32:49 +0100 (MET) Sender: weis Message-ID: <351A9141.3D52@loria.fr> Date: Thu, 26 Mar 1998 18:32:49 +0100 From: Sorin Stratulat X-Mailer: Mozilla 3.01Gold (X11; I; SunOS 5.5.1 sun4m) MIME-Version: 1.0 To: caml-list@inria.fr Subject: operational semantics of = for objects Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Hello ! After comparing the results of the code (see below) executed on different versions of OCAML (1.05 and 1.07), I would like to know if anybody can explain me how the equality operator works for objects (if it is possible in both versions). As I understood from a previous message, overloading the operators is not supported yet. Here you have two examples where I mainly created a class and some instances that are further compared: example 1 ------------ Objective Caml version 1.07 # class point x_init = val mutable x = x_init method get_x = x method move d = x <- x + d end;; class point (int) = val mutable x : int method get_x : int method move : int -> unit end # let p = new point 7;; val p : point = # let q = new point 7;; val q : point = # p=q;; - : bool = false # List.mem (new point 7) [p;q];; - : bool = false # let r = p;; val r : point = # p=r;; - : bool = true # example 2 ----------------- Objective Caml version 1.05 # class point x_init = val mutable x = x_init method get_x = x method move d = x <- x + d end;; class point (int) = val mutable x : int method get_x : int method move : int -> unit end # let p = new point 7;; val p : point = # let q = new point 7;; val q : point = # p=q;; - : bool = true # List.mem (new point 7) [p;q];; - : bool = true # let r = p;; val r : point = # p = r;; - : bool = true # Thank you, Sorin -- e-mail : Sorin.Stratulat@loria.fr Project: PROTHEO Office : A201 | Home: ------ | ------ tel: 03.83.59.30.02 | C.U. du Placieux, ch. 1128 LORIA - BP 239 | Bd. Mare'chal Lyautey F-54506 VANDOEUVRE-les-NANCY Cedex FRANCE | 54600 Villers-le`s-Nancy