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=2.1 required=5.0 tests=AWL,DNS_FROM_RFC_ABUSE, SPF_NEUTRAL autolearn=disabled version=3.1.3 Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id 8D5D0BB83 for ; Sun, 3 Sep 2006 03:22:59 +0200 (CEST) Received: from wx-out-0506.google.com (wx-out-0506.google.com [66.249.82.234]) by nez-perce.inria.fr (8.13.6/8.13.6) with ESMTP id k831Mwdu020969 for ; Sun, 3 Sep 2006 03:22:59 +0200 Received: by wx-out-0506.google.com with SMTP id s6so1601935wxc for ; Sat, 02 Sep 2006 18:22:58 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:in-reply-to:references:mime-version:content-type:message-id:cc:content-transfer-encoding:from:subject:date:to:x-mailer; b=dxMz5ioZ4z7S6+y1IFIz//TcE4/FFcyyN39gfkojcJIFkO/BblHdNdhrIdwsnQSIraCVdd9UVLMjYjSSxOgDDp8MGmdmJsLqRCl4vpRWUcn6qa6bzkgLFZnZi8ButXDXkYpd3eaiwsaBAnuBD1SIEO9JSB7QlyHKKRJWjhWMQks= Received: by 10.70.117.3 with SMTP id p3mr6459507wxc; Sat, 02 Sep 2006 18:22:58 -0700 (PDT) Received: from ?192.168.0.3? ( [70.19.59.48]) by mx.gmail.com with ESMTP id h20sm5599587wxd.2006.09.02.18.22.57; Sat, 02 Sep 2006 18:22:57 -0700 (PDT) In-Reply-To: <20060902.201646.110439764.garrigue@math.nagoya-u.ac.jp> References: <012901c6cdec$64edf490$6a7ba8c0@treble> <1157138993.22787.34.camel@rosella.wigram> <7E1CAC5D-67CC-4A5C-8DE6-BB2A60A6615B@gmail.com> <20060902.201646.110439764.garrigue@math.nagoya-u.ac.jp> Mime-Version: 1.0 (Apple Message framework v752.2) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: Cc: caml-list@yquem.inria.fr Content-Transfer-Encoding: 7bit From: Andres Varon Subject: Re: [Caml-list] Polymorphic variants question Date: Sat, 2 Sep 2006 21:22:55 -0400 To: Jacques Garrigue X-Mailer: Apple Mail (2.752.2) X-j-chkmail-Score: MSGID : 44FA2E72.000 on nez-perce : j-chkmail score : X : 0/20 1 X-Miltered: at nez-perce with ID 44FA2E72.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; variants:01 struct:01 struct:01 variants:01 functor:01 2006,:98 wrote:01 polymorphic:01 polymorphic:01 abstract:01 caml-list:01 functions:01 int:01 match:02 string:02 On Sep 2, 2006, at 7:16 AM, Jacques Garrigue wrote: > Just that the concrete type is much simpler. > The abstract type does not work directly, as you need a way to ensure > that B.t and C.t are compatible. Otherwise, one could write > > module D = A(struct type t = [ `A of int] ... end) > (struct type t = [ `A of string] ... end) > > which is clearly incorrect. I use a more restricted version of polymorphic variants to ensure that two functions that are being composed through a match in the style of the question do not share a tag (and so one function will not override the expected behavior of the second one), even if the tags are fully compatible; being this the case, your example cannot occur. I am not an expert in programming languages, and I cannot see - in this restricted case - a reason why that functor could still be problematic. Is there some? Thanks! Andres