From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id E7FE48239C for ; Sat, 3 Feb 2018 00:24:01 +0100 (CET) Authentication-Results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=zhenya1007@gmail.com; spf=Pass smtp.mailfrom=zhenya1007@gmail.com; spf=None smtp.helo=postmaster@mail-yw0-f179.google.com Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of zhenya1007@gmail.com) identity=pra; client-ip=209.85.161.179; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="zhenya1007@gmail.com"; x-sender="zhenya1007@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of zhenya1007@gmail.com designates 209.85.161.179 as permitted sender) identity=mailfrom; client-ip=209.85.161.179; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="zhenya1007@gmail.com"; x-sender="zhenya1007@gmail.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-yw0-f179.google.com) identity=helo; client-ip=209.85.161.179; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="zhenya1007@gmail.com"; x-sender="postmaster@mail-yw0-f179.google.com"; x-conformance=sidf_compatible IronPort-PHdr: =?us-ascii?q?9a23=3A0Sch5RLBhyFCrHLx19mcpTZWNBhigK39O0sv0rFi?= =?us-ascii?q?tYgfK/zxwZ3uMQTl6Ol3ixeRBMOHs6sC07KempujcFRI2YyGvnEGfc4EfD4+ou?= =?us-ascii?q?JSoTYdBtWYA1bwNv/gYn9yNs1DUFh44yPzahANS47xaFLIv3K98yMZFAnhOgpp?= =?us-ascii?q?POT1HZPZg9iq2+yo9JDffxhEiCChbb9uMR67s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ascii?q?485zc7CJinDYjZXIytjqaBj2+HGchqYWpXQnOBFWzlZs3QR/AGeWSRL8t6ny0s?= =?us-ascii?q?Wr2oSotn3har4lzU0b1ie8fK9SAepNrZ08V/5uvYlQ0/9Do8W9ad3mecRjgsxj?= =?us-ascii?q?wgSDo/3aQ5qkt4nATQmZNkiuBVQIQAr8hCVR03YNuBlrUrWeC3YRrIe5KycHjj?= =?us-ascii?q?R9ynBT8rSddomo0BZk98H5OpiRWRhnP2UY9QrKSCAdkPyoyZx2L4fp8vxHPP1a?= =?us-ascii?q?1nhF4jEJMWaD+Ww5Vn/g2WPLbn1kWUk6HwK/YZ1S/JsXaclS+A5R4JFgF3VqrB?= =?us-ascii?q?UDYUYU6E9dk=3D?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0DuBQC58nRahrOhVdFcGgEBAQEBAgEBA?= =?us-ascii?q?QEIAQEBAYQsC3AVEwqDW4E5lxmBXgUfgmeBGYULhV+IXoIYCiOFGAKCMQcZBwQ?= =?us-ascii?q?xFwEBAQEBAQEBAQEBEgEBAQgLCwgoL0IQAYFlJIJHAQEBAwEjHQEbEgsBAwELB?= =?us-ascii?q?gMCBAcNDR0CAiEBAREBBQEKEgYTCAqKCgEDCAUIEJYqkR1AjBeCBQUBHIMLBYN?= =?us-ascii?q?fChknAwpZWIIGAQEBAQEBBAEBAQEBAQEZAgYShFeCFYM/giCBDoJrOQsBA4Icg?= =?us-ascii?q?mqCZQEEgS0BAQGHQQyKXZAMNAgBAYFwCoYfiFCFB4MFkS+NakeJLBQFIIEXDxI?= =?us-ascii?q?BggZwUjJugSYJghMqH4IzIDeBDYsgAQEB?= X-IPAS-Result: =?us-ascii?q?A0DuBQC58nRahrOhVdFcGgEBAQEBAgEBAQEIAQEBAYQsC3A?= =?us-ascii?q?VEwqDW4E5lxmBXgUfgmeBGYULhV+IXoIYCiOFGAKCMQcZBwQxFwEBAQEBAQEBA?= =?us-ascii?q?QEBEgEBAQgLCwgoL0IQAYFlJIJHAQEBAwEjHQEbEgsBAwELBgMCBAcNDR0CAiE?= =?us-ascii?q?BAREBBQEKEgYTCAqKCgEDCAUIEJYqkR1AjBeCBQUBHIMLBYNfChknAwpZWIIGA?= =?us-ascii?q?QEBAQEBBAEBAQEBAQEZAgYShFeCFYM/giCBDoJrOQsBA4IcgmqCZQEEgS0BAQG?= =?us-ascii?q?HQQyKXZAMNAgBAYFwCoYfiFCFB4MFkS+NakeJLBQFIIEXDxIBggZwUjJugSYJg?= =?us-ascii?q?hMqH4IzIDeBDYsgAQEB?= X-IronPort-AV: E=Sophos;i="5.46,451,1511823600"; d="scan'208,217";a="253474502" Received: from mail-yw0-f179.google.com ([209.85.161.179]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/AES128-GCM-SHA256; 03 Feb 2018 00:24:00 +0100 Received: by mail-yw0-f179.google.com with SMTP id b129so14429952ywa.8 for ; Fri, 02 Feb 2018 15:24:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=QvA7PS8prff+QOeGK7g7tAfDsZtzG5sxqJ2zpljSdRA=; b=OplYdgNMF30uoZSiBZkvf9EHVSHaqFZ7e+X7djxXeiCGbSxBwDFXC4ei8fqCGk7Nkt tzrtRhE5tCuEqqOTT9EZ+45BDrIukkGgw3EZeMnbqdlYuclOv52QKcMU3L5DRksANrBW dINZJkgq42pevKJmsNTJll4pcFoOqJtDNsA1Unx7dsYIQcp2Alp6L/Gz30nDNfUOe5cU VyoelAbOVOcnmFpcxqpmqJTYmUDjFlHWFghEgAxjC0bBbyZMQyZ4uylXPHRwyQh39m6E Mev6Sg9snV6bm/HNalZmK248I6ZnOZjA7fyQ+JpxzpFF3TkW/n9NrWxfQz/Yr8qmMVz0 BcHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=QvA7PS8prff+QOeGK7g7tAfDsZtzG5sxqJ2zpljSdRA=; b=ne+5juEzga8hzIeNDS6+bLtvvhOdrifVRR58vRx8QxbFLBpdqWsHQOMGxRIATSW3SO 0LQ8gOXfarN01GjqU1/qSqnaVgLxCJks/mat4FpHqRmFwQD2So9IMkA2+nBOz4I7ls/J OGVCmOe8WOw30jtnWhpxPk2F7WPuH6Yn8uWJ3yaSTrTLz0xbSBDTHUsjFioYpJNp5tIU NmCRjwdtEzntzpTGxZAn2TFsBPF8VWqjlAemX4bd0M9+OHH1gMlVeGyNOfudKOKTIWXF h8ViW6cFSIAEP8MA7jOlX27obIQPI5S5I62CfwmEa+O1jbEkiTLhpLN4N8o67wPW/gOG rr1w== X-Gm-Message-State: AKwxytfgh7SiXvytnQz07tpROd+FQ1xxPY1Q4OJVUuJa2UOuzbQUCarV aaGYwZsvF2uFvUUAQjPOCY07XBWxPENJ9w70vD0= X-Google-Smtp-Source: AH8x224QAsCdkxPzzi9ZIyYNiBCeqtBHaXeFhDsVHAFzjyzk1SqJKLBaQb3uYjgjKD7iqgHEH086U8NdkKXJXFYuCV4= X-Received: by 10.37.10.3 with SMTP id 3mr18233867ybk.397.1517613838633; Fri, 02 Feb 2018 15:23:58 -0800 (PST) MIME-Version: 1.0 Received: by 10.37.178.138 with HTTP; Fri, 2 Feb 2018 15:23:58 -0800 (PST) In-Reply-To: <2e9462f5-4042-230f-104b-943f1e2ebe76@gmail.com> References: <20180123145453.GA1916@Magus.localnet> <4C24893D-6053-4F0D-BFDD-DF76172E64F9@math.nagoya-u.ac.jp> <2e9462f5-4042-230f-104b-943f1e2ebe76@gmail.com> From: Evgeny Roubinchtein Date: Fri, 2 Feb 2018 15:23:58 -0800 Message-ID: To: Toby Kelsey Cc: OCaml Mailing List Content-Type: multipart/alternative; boundary="001a113db840c20ef70564430168" Subject: Re: [Caml-list] Are record types generative? --001a113db840c20ef70564430168 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable One source that explains how record labels are disambiguated is: https://realworldocaml.org/v1/en/html/records.html#reusing-field-names. Parenthetically, it seems to me that your question is hardly related to the subject of this thread, so it may have been better to start a new thread in this case, than to piggy-back onto an existing thread. --=20 Best, Evgeny ("Zhenya") On Fri, Feb 2, 2018 at 3:07 PM, Toby Kelsey wrote: > On 24/01/18 08:43, Jacques Garrigue wrote: > >> I.e., types can be used to optimize a program, but they do not change its >> semantics. >> It=E2=80=99s true of so-called =E2=80=9Coverloaded=E2=80=9D record label= s, it=E2=80=99s true of a labeled >> and default arguments >> (which use type information for compilation, but not semantics), it=E2= =80=99s >> true of objects, >> it=E2=80=99s true of GADT pattern-matching (again optimized), etc=E2= =80=A6 >> > > type foo =3D { x : int } > type bar =3D { x : string } > > let f r =3D r.x (* OK: uses bar *) > let f r =3D (r:foo).x (* OK: uses foo *) > let f r =3D (r.x : int) (* type error - wrong type inferred *) > > > Aren't the semantics different? 'f' has different types in the first two > definitions, And why does type inference fail for the last example? > > Toby > > > -- > Caml-list mailing list. Subscription management and archives: > https://sympa.inria.fr/sympa/arc/caml-list > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs > --001a113db840c20ef70564430168 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
One source that explains how record labels are disamb= iguated is: https://realworldocaml.org/v1/en/html/records.html#reus= ing-field-names.

Parenthetically, it seems to me that= your question is hardly related to the subject of this thread, so it may h= ave been better to start a new thread in this case, than to piggy-back onto= an existing thread.

--
Best,
Evgeny (&= quot;Zhenya")

On Fri, Feb 2, 2018 at 3:07 PM, Toby Kelsey <toby.kel= sey@gmail.com> wrote:
On 24/01/18 08:43, Jacques Garrigue wrote:
I.e., types can be used to optimize a program, but they do not change its s= emantics.
It=E2=80=99s true of so-called =E2=80=9Coverloaded=E2=80=9D record labels, = it=E2=80=99s true of a labeled and default arguments
(which use type information for compilation, but not semantics), it=E2=80= =99s true of objects,
=C2=A0 it=E2=80=99s true of GADT pattern-matching (again optimized), etc=E2= =80=A6

type foo =3D { x : int }
type bar =3D { x : string }

let f r =3D r.x=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= (* OK: uses bar *)
let f r =3D (r:foo).x=C2=A0 (* OK: uses foo *)
let f r =3D (r.x : int) (* type error - wrong type inferred *)


Aren't the semantics different? 'f' has different types in the = first two definitions, And why does type inference fail for the last exampl= e?

Toby


--
Caml-list mailing list.=C2=A0 Subscription management and archives:
https://sympa.inria.fr/sympa/arc/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

--001a113db840c20ef70564430168--