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 mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by yquem.inria.fr (Postfix) with ESMTP id 14959BC69 for ; Thu, 18 Oct 2007 12:31:36 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAAGrTFkfOvjGvoWdsb2JhbACOTgIBAQIFBAYJCAEXgSc X-IronPort-AV: E=Sophos;i="4.21,295,1188770400"; d="scan'208";a="18185865" Received: from web54605.mail.re2.yahoo.com ([206.190.49.175]) by mail4-smtp-sop.national.inria.fr with SMTP; 18 Oct 2007 12:31:35 +0200 Received: (qmail 15719 invoked by uid 60001); 18 Oct 2007 10:31:34 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-ID; b=Y12QCcYWlWHh8u3/LpD+6ytU/r3BoAXdOJM5QkzJUanqpcU5C+RiVSPAKxidoqMaL6tE4UKWQBCrVhWX2YVcqsyLJGBLqtJk1pGU5B4ZkmI4vg9OeFHASY/t+ZauDta/gyYMdpNBhAl1nEUv3mOhpUpmOJbcDpk4yiDYwc5jzu8=; X-YMail-OSG: Gy22.fEVM1lFZnJjhmucSvxBuDKTGSu5HrJ03FuI5imL3_sAhaUOaMc.KrdoN59AjEr1g897hZcvyMOM63QUQNskKoLqOJxcIdZli9Ky37mQyKIT246n0Phl04P3AQ-- Received: from [82.155.120.49] by web54605.mail.re2.yahoo.com via HTTP; Thu, 18 Oct 2007 11:31:34 BST Date: Thu, 18 Oct 2007 11:31:34 +0100 (BST) From: Dario Teixeira Subject: Re: [Caml-list] Smells like duck-typing To: Stefano Zacchiroli , caml-list@yquem.inria.fr In-Reply-To: <20071018073742.GB523@takhisis.invalid> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Message-ID: <522073.15700.qm@web54605.mail.re2.yahoo.com> X-Spam: no; 0.00; conceptually:01 derivation:01 real-world:01 cheers:01 carbon:98 ideally:01 typing:01 caml-list:01 inherit:01 constraint:01 int:01 string:02 string:02 inheritance:03 inheritance:03 Hi, > Uhm sorry, why aren't you going for the object *with* inheritance > solution? The one you're proposing here is more lightweight than the > initial one due to the lack of option types, not due to the lack of > inheritance. > > Can't you just go for: > > class blurb (id, title, intro) = > object > method id: int = id > method title: string = title > method intro: string = intro > end > > class full (id, title, intro, body) = > object > inherit blurb (id, title, intro) > method body: string = body > end While that would indeed involve a little bit of less typing, it's also conceptually wrong, because a Full story is not a derivation of a Blurb with an extra field. Ideally, I should be able to declare a "platonic" Story that includes all fields that describe a story. A Full story is just the real-world clone of the platonic ideal, while a Blurb is a Story with the constraint that there is no "body" field declared (and so on). Cheers, Dario ___________________________________________________________ Want ideas for reducing your carbon footprint? Visit Yahoo! For Good http://uk.promotions.yahoo.com/forgood/environment.html