From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.4 required=5.0 tests=AWL,DNS_FROM_RFC_ABUSE autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by yquem.inria.fr (Postfix) with ESMTP id 08746BC69 for ; Fri, 19 Oct 2007 02:59:09 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ao8CALyeF0eCNhAB/2dsb2JhbAA X-IronPort-AV: E=Sophos;i="4.21,297,1188770400"; d="scan'208";a="4825792" Received: from concorde.inria.fr ([192.93.2.39]) by mail3-smtp-sop.national.inria.fr with ESMTP; 19 Oct 2007 02:59:08 +0200 Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id l9J0x7Ba010249 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Fri, 19 Oct 2007 02:59:08 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ao8CALyeF0eCNhAB/2dsb2JhbAA X-IronPort-AV: E=Sophos;i="4.21,297,1188770400"; d="scan'208";a="4825782" Received: from kurims.kurims.kyoto-u.ac.jp ([130.54.16.1]) by mail3-smtp-sop.national.inria.fr with ESMTP; 19 Oct 2007 02:59:06 +0200 Received: from localhost (orion [130.54.16.5]) by kurims.kurims.kyoto-u.ac.jp (8.13.8/8.13.8) with ESMTP id l9J0x0KP000861; Fri, 19 Oct 2007 09:59:00 +0900 (JST) Date: Fri, 19 Oct 2007 09:58:47 +0900 (JST) Message-Id: <20071019.095847.34380336.garrigue@math.nagoya-u.ac.jp> To: wneumann@cs.unm.edu Cc: li@pps.jussieu.fr, caml-list@inria.fr Subject: Re: [Caml-list] Re: Smells like duck-typing From: Jacques Garrigue In-Reply-To: <20071018163527.M63738@cs.unm.edu> References: <877ill225i.fsf@pps.jussieu.fr> <877ilkwgdq.fsf@pps.jussieu.fr> <20071018163527.M63738@cs.unm.edu> X-Mailer: Mew version 4.2 on Emacs 22.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Miltered: at concorde with ID 4718015B.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; 0200,:01 bug:01 val:01 hmmm:01 val:01 bug:01 wrote:01 experimental:01 caml-list:01 inherit:01 coercion:01 undefined:01 int:01 int:01 caml:02 From: "William D. Neumann" > On Thu, 18 Oct 2007 18:13:05 +0200, Zheng Li wrote > > > Strangely though, there seems to be a bug in the OO type system: > > (The solution proposed above is safe, as it does coercion) > > > > # let coredump = object inherit templt end;; > > val coredump : templt = > > # coredump#title;; > > > > Process caml-toplevel segmentation fault > > Hmmm... interesting. You can apparently create immediate objects with > virtual instance variables, so long as you don't have virtual methods. > > Objective Caml version 3.10.0 > > # let bad = object method virtual ooops : int end;; > Characters 10-47: > let bad = object method virtual ooops : int end;; > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > This class should be virtual. The following methods are undefined : ooops > # let bad_int = object val virtual x : int method get_x = x end;; > val bad_int : < get_x : int > = > # let bad_str = object val virtual x : string method get_x = x end;; > val bad_str : < get_x : string > = > # bad_int # get_x;; > - : int = 0 > # bad_str # get_x;; Virtual fields are a new and experimental feature in 3.10. The above bug was fixed shortly after the release. Jacques Garrigue