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.1 required=5.0 tests=AWL,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 351D4BC0B for ; Tue, 16 Jan 2007 22:45:32 +0100 (CET) Received: from an-out-0708.google.com (an-out-0708.google.com [209.85.132.245]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l0GLjV9A030492 for ; Tue, 16 Jan 2007 22:45:31 +0100 Received: by an-out-0708.google.com with SMTP id c24so1142532ana for ; Tue, 16 Jan 2007 13:45:31 -0800 (PST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:user-agent:mime-version:to:cc:subject:references:in-reply-to:content-type:content-transfer-encoding; b=foAiZje8SO/xsThMqtkRwgLdmQyf/4qmlnk9GSLAkPTVc92KuvsSf7u/jI85dzjkDJFoyHRApMMRs1g6SZLBTxRHx1n5l7gWGALmlzQMtg4c/l5FkSDTPCoWthg6XZOiPk49J8YuP2qW/55VAVTvUYFn5c2jnEGffXmvbzlR0BA= Received: by 10.65.59.11 with SMTP id m11mr2168309qbk.1168983930701; Tue, 16 Jan 2007 13:45:30 -0800 (PST) Received: from ?192.168.0.18? ( [69.155.31.57]) by mx.google.com with ESMTP id 1sm8886595qbh.2007.01.16.13.45.29; Tue, 16 Jan 2007 13:45:30 -0800 (PST) Message-ID: <45AD4778.4010402@gmail.com> Date: Tue, 16 Jan 2007 15:45:28 -0600 From: Edgar Friendly User-Agent: Thunderbird 1.5.0.9 (X11/20061206) MIME-Version: 1.0 To: "Seth J. Fogarty" Cc: caml-list Subject: Re: [Caml-list] Polymorphic Variants References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-j-chkmail-Score: MSGID : 45AD477B.001 on discorde : j-chkmail score : X : 0/20 1 0.000 -> 1 X-Miltered: at discorde with ID 45AD477B.001 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; variants:01 subtyping:01 ocaml:01 uglier:01 ocaml's:01 accessors:01 accessors:01 edgar:98 polymorphic:01 wrote:01 typing:01 caml-list:01 tuples:01 int:01 string:02 Seth J. Fogarty wrote: >> 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. > > OCaml's records are tuples with named accessors to the components. Within a namespace, these accessors must be unique, so the type independent wouldn't be possible, because the my_only component wouldn't always be in the same position. E.