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.6 required=5.0 tests=MISSING_HEADERS,SPF_NEUTRAL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id 8DFD7BC0B for ; Tue, 16 Jan 2007 22:23:35 +0100 (CET) Received: from nf-out-0910.google.com (nf-out-0910.google.com [64.233.182.188]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l0GLNZMl026763 for ; Tue, 16 Jan 2007 22:23:35 +0100 Received: by nf-out-0910.google.com with SMTP id q29so1702nfc for ; Tue, 16 Jan 2007 13:23:34 -0800 (PST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=eH5XXEh3Wq9VhHc1KD1YRIbb8ednwEhP8ZHiQh0F6jNwxe3ts/I3Ww+Qi07ZuLP62iN5Z3uaI2376pE12YbAaux1pMZUryhaanV4CYzULyD68cfsLzPhKSb48lQpn7u2ycjfwavuhDL0dHZzaotZPVUkG9ss1e4I05Z/zXwBTDo= Received: by 10.82.120.15 with SMTP id s15mr1340687buc.1168982614060; Tue, 16 Jan 2007 13:23:34 -0800 (PST) Received: by 10.82.165.20 with HTTP; Tue, 16 Jan 2007 13:23:34 -0800 (PST) Message-ID: Date: Tue, 16 Jan 2007 15:23:34 -0600 From: "Seth J. Fogarty" Subject: Re: [Caml-list] Polymorphic Variants Cc: caml-list In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: X-j-chkmail-Score: MSGID : 45AD4257.000 on discorde : j-chkmail score : X : 0/20 1 0.000 -> 1 X-Miltered: at discorde with ID 45AD4257.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; variants:01 variants:01 polymorphism:01 annotation:01 subtyping:01 ocaml:01 uglier:01 luther:01 thirst:98 hatred:98 polymorphic:01 polymorphic:01 wrote:01 wrote:01 typing:01 On 1/16/07, Tom wrote: > > > On 16/01/07, Seth J. Fogarty wrote: > > > > 2) When I have different overlapping kinds of data, with a common root > > and common parent, and functions that are only defined on certain > > branches of the 'type tree.' This would be the hardest to replicate. > > > > Could this be replicated by either > using overloaded non-polymorphic variants, meaning that say Int of int can > be shared by many types (almost like polymorphic variants, just that it is > declared, and thus (at least I believe so) more typesafe) Are you going to allow translation between these? Rho-variable polymorphism is 'The Right Thing To Do' in this case with minimal type annotation. > using records with overloaded fields and subtyping, so that you could have: > type top = {common of string} > type one_level_deep = {top | my_only of int} > > type independent = {my_only of string} > so this would be possible: > let to_str x -> x.common > > to_str {common = "first"}; to_str {common = "second"; my_only = 0} > ? OCaml does not, as far as I know, have any structural typing for records.. and I am not sure this would be at all cleaner. It might WORK, but it would be just as ugly, if not uglier. -- Seth Fogarty sfogarty@[gmail.com|rice.edu|livejournal] Neep-neep at large AIM: Sorrath "Let us not seek to satisfy our thirst for freedom by drinking from the cup of bitterness and hatred." - Martin Luther King, Jr.