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 mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by yquem.inria.fr (Postfix) with ESMTP id BF960BC69 for ; Thu, 18 Oct 2007 19:04:29 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAAIguF0dAahQhh2dsb2JhbACOTQIBCAop X-IronPort-AV: E=Sophos;i="4.21,296,1188770400"; d="scan'208";a="3221662" Received: from mail.cs.unm.edu ([64.106.20.33]) by mail1-smtp-roc.national.inria.fr with ESMTP; 18 Oct 2007 19:04:29 +0200 Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.cs.unm.edu (Postfix) with ESMTP id E7D0BE4175; Thu, 18 Oct 2007 11:04:27 -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 04143-02; Thu, 18 Oct 2007 11:04:27 -0600 (MDT) Received: from cs.unm.edu (webmail.cs.unm.edu [64.106.20.39]) by mail.cs.unm.edu (Postfix) with ESMTP id 5EE39E415A; Thu, 18 Oct 2007 11:04:27 -0600 (MDT) From: "William D. Neumann" To: Brian Hurt , Dario Teixeira Cc: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Smells like duck-typing Date: Thu, 18 Oct 2007 12:04:38 -0500 Message-Id: <20071018165855.M16279@cs.unm.edu> In-Reply-To: <47178D1E.5050409@janestcapital.com> References: <939878.37106.qm@web54604.mail.re2.yahoo.com> <47178D1E.5050409@janestcapital.com> 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-Spam: no; 0.00; val:01 wrote:01 caml-list:01 inherit:01 int:01 int:01 defined:02 neumann:02 neumann:02 string:02 string:02 let:03 let:03 types:05 thu:05 On Thu, 18 Oct 2007 12:43:10 -0400, Brian Hurt wrote > So now you've defined full_story, blurb_story, and fresh_story as > types. Now, I write: > > let get_body (story: full_story) = story#get_body;; > > let my_blurb = new blurb_story(id, "A Title", "An Intro");; > > let my_body = get_body my_blurb;; > > what happens? One would assume the same thing that happens if you were to do: class full_story = object inherit blurb_story val body method body = body end;; let get_body (story: full_story) = story#get_body;; let my_blurb = new blurb_story(id, "A Title", "An Intro");; let my_body = get_body my_blurb;; That is an error indicating that my_body has type < id : int; title : string; summary : string > but is used with type < get_body : string ..>, < id : int; title : string; summary : string > has no method get_body. No? -- William D. Neumann