From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id EA747BB81 for ; Sat, 25 Feb 2006 11:50:24 +0100 (CET) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id k1PAoOa8024064 for ; Sat, 25 Feb 2006 11:50:24 +0100 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 LAA18056 for ; Sat, 25 Feb 2006 11:50:23 +0100 (MET) Received: from smtp001.mail.ukl.yahoo.com (smtp001.mail.ukl.yahoo.com [217.12.11.32]) by concorde.inria.fr (8.13.0/8.13.0) with SMTP id k1PAoMKg004210 for ; Sat, 25 Feb 2006 11:50:23 +0100 Received: (qmail 75496 invoked from network); 25 Feb 2006 10:50:22 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.fr; h=Received:Message-ID:Date:From:Reply-To:User-Agent:X-Accept-Language:MIME-Version:To:Subject:Content-Type:Content-Transfer-Encoding; b=mmo5zaSyUCT2JoUNeNkVyL3LRQYYoe6GwNFMEETKSq4Ei22Uw+bZ32iQc+5w/8vGsGleevGdMZ2EUsOeVh1JWeGanQP8fu9USQ/8Cxgj//o3+QXnirBoi8XFj3GOH+eU9FpZZioJe5vqi2M1tAt7UUgNJ4XisxxgszUvikOaaIs= ; Received: from unknown (HELO ?84.102.56.68?) (sejourne?kevin@84.102.56.68 with plain) by smtp001.mail.ukl.yahoo.com with SMTP; 25 Feb 2006 10:50:21 -0000 Message-ID: <440038EC.5060302@yahoo.fr> Date: Sat, 25 Feb 2006 12:01:00 +0100 From: sejourne_kevin Reply-To: sejourne@limsi.fr User-Agent: Mozilla Thunderbird 1.0.7 (X11/20051017) X-Accept-Language: fr, en MIME-Version: 1.0 To: caml-list Subject: multiple inheritance, bug or feature ? Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Miltered: at nez-perce with ID 44003670.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at concorde with ID 4400366F.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; bug:01 val:01 mutable:01 printf:01 printf:01 val:01 mutable:01 bug:01 telechargez:98 wrote:01 inherit:01 inherit:01 int:01 int:01 defined:01 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.3 Hello : Consider the following sample : class a = object val mutable x = 0 method set v = Printf.printf "%d\n" x;x <- v end ;; class a : object val mutable x : int method set : int -> unit end class b = object val mutable y = 0 method set v = Printf.printf "%d\n" y;y <- v end ;; class b : object val mutable y : int method set : int -> unit end class c = object (self) inherit a as aa inherit a as bb inherit b as cc method set_x_a x = aa#set x method set_x_a' x = bb#set x method set_y x = cc#set x end ;; Warning M: the following methods are overriden by the inherited class: set Warning V: this definition of an instance variable x hides a previously defined instance variable of the same name. Warning M: the following methods are overriden by the inherited class: set class c : object val mutable x : int val mutable y : int method set : int -> unit method set_x_a : int -> unit method set_x_a' : int -> unit method set_y : int -> unit end let d = new c;; val d : c = d#set_x_a 3;; 0 - : unit = () d#set_x_a' 2;; 0 - : unit = () When I wrote this program I expect this behavior but according to the warnings M the result should be 3. If methods are overriden, the same instance variable should be change (according to the type of class c too). If the variable isn't change the method are not overriden. So because methods are not overriden, I think there is a bug in the warning system. The warning V look also suspicious. Kevin. ___________________________________________________________________________ Nouveau : téléphonez moins cher avec Yahoo! Messenger ! Découvez les tarifs exceptionnels pour appeler la France et l'international. Téléchargez sur http://fr.messenger.yahoo.com