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=1.1 required=5.0 tests=AWL,DNS_FROM_RFC_BOGUSMX 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 96075BC69 for ; Thu, 18 Oct 2007 18:37:38 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAAGMoF0fAXQImh2dsb2JhbACOTQIBCAop X-IronPort-AV: E=Sophos;i="4.21,296,1188770400"; d="scan'208";a="4742671" Received: from discorde.inria.fr ([192.93.2.38]) by mail3-smtp-sop.national.inria.fr with ESMTP; 18 Oct 2007 18:37:38 +0200 Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l9IGbbRp029087 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Thu, 18 Oct 2007 18:37:38 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAADYoF0dAahQhh2dsb2JhbACOTQIBCAop X-IronPort-AV: E=Sophos;i="4.21,296,1188770400"; d="scan'208";a="3248547" Received: from mail.cs.unm.edu ([64.106.20.33]) by mail2-smtp-roc.national.inria.fr with ESMTP; 18 Oct 2007 18:37:36 +0200 Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.cs.unm.edu (Postfix) with ESMTP id 25CE2E4159; Thu, 18 Oct 2007 10:37:36 -0600 (MDT) Received: from mail.cs.unm.edu ([127.0.0.1]) by localhost (mail [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 03097-07; Thu, 18 Oct 2007 10:37:35 -0600 (MDT) Received: from cs.unm.edu (webmail.cs.unm.edu [64.106.20.39]) by mail.cs.unm.edu (Postfix) with ESMTP id 8D24DE4157; Thu, 18 Oct 2007 10:37:35 -0600 (MDT) From: "William D. Neumann" To: Zheng Li , caml-list@inria.fr Subject: Re: [Caml-list] Re: Smells like duck-typing Date: Thu, 18 Oct 2007 11:37:46 -0500 Message-Id: <20071018163527.M63738@cs.unm.edu> In-Reply-To: <877ilkwgdq.fsf@pps.jussieu.fr> References: <932096.75090.qm@web54602.mail.re2.yahoo.com> <877ill225i.fsf@pps.jussieu.fr> <877ilkwgdq.fsf@pps.jussieu.fr> X-Mailer: Open WebMail 2.50 20050106 X-OriginatingIP: 205.175.225.22 (wneumann) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at cs.unm.edu X-Miltered: at discorde with ID 47178BD1.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 boom:98 wrote:01 caml-list:01 inherit:01 coercion:01 undefined:01 int:01 int:01 caml:02 objective:02 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;; *boom!* -- William D. Neumann