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 C39EDBC0B for ; Tue, 16 Jan 2007 23:18:36 +0100 (CET) Received: from nf-out-0910.google.com (nf-out-0910.google.com [64.233.182.187]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l0GMIaKV003736 for ; Tue, 16 Jan 2007 23:18:36 +0100 Received: by nf-out-0910.google.com with SMTP id q29so16187nfc for ; Tue, 16 Jan 2007 14:18:34 -0800 (PST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=l7AmW5OYf0fhuh+A8g2l1Gz2E4mpleF/SUwbTKWLQh9hn7D7nm1H8nWMa6i0XvGmxemHbb7miAVUTjtZeETVZVE2ex//zntShQ7pg95zK69lFptAyiG/uViELeeyMT+S098+J4ynlJXo9mjnSSrDS6wqp+NnPlhHLdVWzc5BvkE= Received: by 10.82.182.8 with SMTP id e8mr1369469buf.1168985911950; Tue, 16 Jan 2007 14:18:31 -0800 (PST) Received: by 10.82.135.5 with HTTP; Tue, 16 Jan 2007 14:18:31 -0800 (PST) Message-ID: <4a708d20701161418o1e3e3310t376e6ab83c3ff8dd@mail.gmail.com> Date: Tue, 16 Jan 2007 23:18:31 +0100 From: "Lukasz Stafiniak" To: caml-list Subject: Re: [Caml-list] Polymorphic Variants 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 : 45AD4F3C.000 on discorde : j-chkmail score : X : 0/20 1 0.000 -> 1 X-Miltered: at discorde with ID 45AD4F3C.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; lukasz:01 variants:01 subtyping:01 ocaml:01 uglier:01 ocaml:01 subtyping:01 variants:01 polymorphic:01 polymorphic:01 wrote:01 wrote:01 typing:01 caml-list:01 int:01 On 1/16/07, Seth J. Fogarty wrote: > On 1/16/07, Tom wrote: > > > > > > On 16/01/07, 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 has objects, which is a heavy-weight solution to the "structural subtyping for records" problem. Polymorphic variants make one wonder, if such light-weight solution could exist for records also, and you conjecture, that it doesn't. What is the minimal nice version of structural subtyping for records? Is it objects without classes and field / method separation (but with late binding)?