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=0.0 required=5.0 tests=none 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 52D40BC37 for ; Fri, 29 May 2009 16:22:09 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AsEBAKSMH0qCcYARkmdsb2JhbACYFQEBAQEJCwoHD7hehAwF X-IronPort-AV: E=Sophos;i="4.41,271,1241388000"; d="scan'208";a="40785879" Received: from coriana6.cis.mcmaster.ca ([130.113.128.17]) by mail4-smtp-sop.national.inria.fr with ESMTP; 29 May 2009 16:22:08 +0200 Received: from Dura7.UTS.McMaster.CA (dura7.UTS.McMaster.CA [130.113.196.62]) by coriana6.cis.mcmaster.ca (8.13.7/8.13.7) with ESMTP id n4TELZXE017235; Fri, 29 May 2009 10:22:05 -0400 (EDT) Received: from cgpsrv2.cis.mcmaster.ca (univmail.CIS.mcmaster.ca [130.113.64.46]) by Dura7.UTS.McMaster.CA (8.13.7/8.13.7) with ESMTP id n4TEKngt009868; Fri, 29 May 2009 10:21:16 -0400 Received: from [129.97.169.240] (account carette@univmail.cis.mcmaster.ca [129.97.169.240] verified) by cgpsrv2.cis.mcmaster.ca (CommuniGate Pro SMTP 5.2.12) with ESMTPA id 255821190; Fri, 29 May 2009 10:21:12 -0400 Message-ID: <4A1FEF57.1080905@mcmaster.ca> Date: Fri, 29 May 2009 10:21:11 -0400 From: Jacques Carette User-Agent: Thunderbird 2.0.0.21 (Windows/20090302) MIME-Version: 1.0 To: Dario Teixeira Cc: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Width subtyping References: <327446.80988.qm@web111511.mail.gq1.yahoo.com> In-Reply-To: <327446.80988.qm@web111511.mail.gq1.yahoo.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-PMX-Version-Mac: 5.5.5.374460, Antispam-Engine: 2.7.1.369594, Antispam-Data: 2009.5.29.141117 X-PerlMx-Spam: Gauge=IIIIIIII, Probability=8%, Report=' BODY_SIZE_1000_LESS 0, BODY_SIZE_2000_LESS 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0, BODY_SIZE_700_799 0, __BOUNCE_CHALLENGE_SUBJ 0, __CT 0, __CTE 0, __CT_TEXT_PLAIN 0, __HAS_MSGID 0, __MIME_TEXT_ONLY 0, __MIME_VERSION 0, __MOZILLA_MSGID 0, __SANE_MSGID 0, __USER_AGENT 0' X-Spam: no; 0.00; subtyping:01 variants:01 subtyping:01 variants:01 o'caml:01 o'caml's:01 o'caml's:01 polymorphic:01 polymorphic:01 wrote:01 caml-list:01 width:97 mcmaster:02 objects:02 jacques:03 Dario Teixeira wrote: > In other words, polymorphic variants provide a very elegant solution for subtyping > with sum types. Is there some brilliant idea that could do the same for product types? > The dual of sums is products. Open (labelled) sums are "polymorphic variants". Their duals are open (labelled) products are "rows" (which O'Caml already supports, through its objects). See TAPL for a nice introduction to the type theory of labelled records with subtyping (i.e. rows). Jacques PS: note that O'Caml's products are positional while its sums are labelled, so the duality present in the theory isn't as clear there. The better dual for O'Caml's sums is really records.