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 D54CDBC69 for ; Wed, 17 Oct 2007 22:24:06 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAAMgLFkfOvjGvoWdsb2JhbACOTgIBAQIFBAYRAReBJw X-IronPort-AV: E=Sophos;i="4.21,290,1188770400"; d="scan'208";a="3125453" Received: from web54605.mail.re2.yahoo.com ([206.190.49.175]) by mail1-smtp-roc.national.inria.fr with SMTP; 17 Oct 2007 22:24:06 +0200 Received: (qmail 307 invoked by uid 60001); 17 Oct 2007 20:24:05 -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=vhB9qXfnangd12xaM5hRsxWssSkly3keVtATLIWgbVV2vfLZZulwi+RwAQvn8eN+vHfFlw3SoESCf3kYRSSXPpkHujECqeXxiPgirtSfZx7voaeijbXQbKPthVwFo2Tuc6hE2mBr4HTYswYoj93a03s/A8ffnlXhAqutByLsbYs=; X-YMail-OSG: Na63fQQVM1k9PxKmHVUHU8xNR_sRw9Ov5AdroAbdfhK2SBUznDgDJqd2mEofs8SSSlBbdtQ_p1chqArCrOB5KbxKBz2dXVU4Ma9u5TXkimoox.YTP1kyV7VOV5ipFVBjgfQPT0EuYq3lOr7YG2lGO6j2Jg-- Received: from [82.155.120.49] by web54605.mail.re2.yahoo.com via HTTP; Wed, 17 Oct 2007 21:24:05 BST Date: Wed, 17 Oct 2007 21:24:05 +0100 (BST) From: Dario Teixeira Subject: Re: [Caml-list] Smells like duck-typing To: caml-list@yquem.inria.fr In-Reply-To: <932096.75090.qm@web54602.mail.re2.yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Message-ID: <110865.97148.qm@web54605.mail.re2.yahoo.com> X-Spam: no; 0.00; ocaml's:01 subtyping:01 cheers:01 duck:98 carbon:98 avoids:01 caml-list:01 int:01 int:01 reuse:01 variant:02 declaration:02 string:02 string:02 module:03 Hi, And a big thanks to everyone -- you've really given me a lot of interesting ideas. For the time being, I am going for the no-inheritance object solution: it avoids the option type mess, provides a clean interface to users of the module, and allows code reuse thanks to OCaml's structural subtyping feature (the "duck" in this thread's title). Moreover, while obviously not as concise as a record, the declaration of each story variant is still quite economical: class full (id, title, intro, body) = object method id: int = id method title: string = title method intro: string = intro method body: string = body end class blurb (id, title, intro) = object method id: int = id method title: string = title method intro: string = intro end Etc, etc. I can live with this. Cheers, Dario ___________________________________________________________ Want ideas for reducing your carbon footprint? Visit Yahoo! For Good http://uk.promotions.yahoo.com/forgood/environment.html