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.0 required=5.0 tests=AWL,DNS_FROM_RFC_ABUSE, DNS_FROM_RFC_WHOIS 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 BC51BBC69 for ; Thu, 18 Oct 2007 19:58:04 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAAGw7F0fOvjGroWdsb2JhbACOTQIBAQIFBAYJCAEXgSc X-IronPort-AV: E=Sophos;i="4.21,296,1188770400"; d="scan'208";a="3229057" Received: from web54601.mail.re2.yahoo.com ([206.190.49.171]) by mail1-smtp-roc.national.inria.fr with SMTP; 18 Oct 2007 19:58:04 +0200 Received: (qmail 51791 invoked by uid 60001); 18 Oct 2007 17:58:03 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:Date:From:Subject:To:Cc:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-ID; b=J7hCd3sqxPUVwpGE9uaDLt90mVg5PHJa2Z9ua0MVt5JcjkIXZpxQogdpe8cmn6lwgx8xPFl7Cu2RhLS5CqEijQuW/Tq6DMTwARm7OskkTk2MqF1eWpzlWlW5gewvUaux8zqq6T9ZyWGlDhcAWuO10p4esAw2T9MmKN+tW8iuUXg=; X-YMail-OSG: zCrxG44VM1mH5hnnyy7ULQArensj5PjLEgJ5JVm8EXt9ml7.DQhqm0oMZSzi4G3.AECyDAfAwyQjjhUxcgTe7ObHUzpLyjlUypBaPNTiXTk_Fg59oYfeKNcFCxIA Received: from [82.155.125.49] by web54601.mail.re2.yahoo.com via HTTP; Thu, 18 Oct 2007 18:58:03 BST Date: Thu, 18 Oct 2007 18:58:03 +0100 (BST) From: Dario Teixeira Subject: Re: [Caml-list] Smells like duck-typing To: Brian Hurt Cc: caml-list@yquem.inria.fr In-Reply-To: <47179638.6080605@janestcapital.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Message-ID: <372004.51009.qm@web54601.mail.re2.yahoo.com> X-Spam: no; 0.00; ocaml's:01 semantics:01 cheers:01 carbon:98 wrote:01 caml-list:01 oop:01 oop:01 precisely:01 fewer:02 inheritance:03 inheritance:03 stories:95 stories:95 complex:05 Hi, > So all full stories are also blurbs, but blurbs are not full stories. > So full stories are a more specific type than blurbs are, because while > we can always use a full story as a blurb, we can't use a blurb as a > full story. Nope, nothing like that. Read carefully what I wrote: I simply said that any method that works on a blurb should also work on a full story. I didn't say anything about reversing the IS-A relation (and yes, I know that OCaml's inheritance has different semantics, but I am talking here about OOP in general). In fact, a blurb is a kind of story. Just one that has been restricted such that some of story's fields/methods cannot be used on blurb. Now the OOP purists will jump and say that this violates inheritance. Which is precisely my point and why I don't call it inheritance! > It's much easier, rather than detecting when things have to be removed, > to simply detect when things can be added. Every "remove members" > relationship can be expressed as an "add members" relationship going the > other direction. Start with the simpler (fewer members) type and then > create the derived type by adding members to make the more complex (more > members) type. Anything you can do with one direction of deriving types > you can do with the other direction of deriving. That is true for most problems. However, I just described one particular class of problem where it is more natural (and correct if you will) to derive by deconstruction rather than by construction. Cheers, Dario ___________________________________________________________ Want ideas for reducing your carbon footprint? Visit Yahoo! For Good http://uk.promotions.yahoo.com/forgood/environment.html