From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by c5ff346549e7 (Postfix) with ESMTPS id 60B605D4 for ; Thu, 6 Sep 2018 13:03:22 +0000 (UTC) X-IronPort-AV: E=Sophos;i="5.53,338,1531778400"; d="scan'208";a="345247419" Received: from sympa.inria.fr ([193.51.193.213]) by mail2-relais-roc.national.inria.fr with ESMTP; 06 Sep 2018 15:03:18 +0200 Received: by sympa.inria.fr (Postfix, from userid 20132) id BC1D7824B5; Thu, 6 Sep 2018 15:03:18 +0200 (CEST) Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id E7639824B2 for ; Thu, 6 Sep 2018 15:03:15 +0200 (CEST) Authentication-Results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=enrico.tassi@inria.fr; spf=None smtp.mailfrom=gares@fettunta.org; spf=None smtp.helo=postmaster@fettunta.org IronPort-PHdr: =?us-ascii?q?9a23=3AX7CroBSNW2hgI/G9mozrpetfjNpsv+yvbD5Q0YIu?= =?us-ascii?q?jvd0So/mwa69ZxGN2/xhgRfzUJnB7Loc0qyK6/+mATRIyK3CmUhKSIZLWR4BhJ?= =?us-ascii?q?detC0bK+nBN3fGKuX3ZTcxBsVIWQwt1Xi6NU9IBJS2PAWK8TW94jEIBxrwKxd+?= =?us-ascii?q?KPjrFY7OlcS30P2594HObwlSizexfbF/IA+qoQnNq8IbnZZsJqEtxxXTv3BGYf?= =?us-ascii?q?5WxWRmJVKSmxbz+MK994N9/ipTpvws6ddOXb31cKokQ7NYCi8mM30u683wqRbD?= =?us-ascii?q?VwqP6WACXWgQjxFFHhLK7BD+Xpf2ryv6qu9w0zSUMMHqUbw5Xymp4qF2QxHqlS?= =?us-ascii?q?gHLSY0/m/XhMJukaxVoxyhqBNjzIHJYo6aOuFzfr/Bcd4AWWZNQtxcWzJHD4ih?= =?us-ascii?q?b4UPFe0BPeNAoofyoVsOtxq+ChWrBOjy1DFHnGT23bY70+88FgzJwgogH8gPsH?= =?us-ascii?q?vIq9X5LrsSXvquzKnTzDXOdPJW2THn6IjJaB8tu/+MXahpfMfX1EIhGQTFjlCK?= =?us-ascii?q?pozkOTOYzuUNs26B7+phT+2jkWAnqxt3rzOyxckskpHEi4Yax1ze6yl0zpw5KN?= =?us-ascii?q?y8RUJhfNKoDplduzmHO4Z4Qc4uWWVltScgxrAJvZO3ZjYGxZsmyhPZdveJaZKH?= =?us-ascii?q?4gj5W+aUOTp4hGxqeLa4hxuq/0iv1PH8VtWp0FZMsipKiMPAtncX1xzc8sSHS/?= =?us-ascii?q?198Vm92TuX0w3e5ftILV46mKbBKpMsxqQ8mocNvUnBBiP2nV/5jK6SdkUq4Oio?= =?us-ascii?q?7OHnb63pppCGLY97lBr+P78gmsOhHeQ4LhUOX26H+eumzrHj+lf5QLpSgv0sjq?= =?us-ascii?q?bZqIzaJdgcpqOhHwBayIMj6xKmAzei0dQYhmUHIUleeBOHiojpI0vBLOr5Dfe5?= =?us-ascii?q?mVSskS1ky+rIPr37Ud3xKS3ImbLlOLJ88FJ0yQwpzNkZ6YgHJKsGJafeXFXwv9?= =?us-ascii?q?uQMhYiKA38l+vhEtR20cUCUHmUA4eYNrnTuBmG/LR8cKG3eIYJtWOleLAe7Pn0?= =?us-ascii?q?gCphwA5PTeySxZISLUuAMLFjKkSdb2Drh45dQ2kHohYjSvDjzlqYXmwLPirgb+?= =?us-ascii?q?cH/jg+TbmeI8LbXIn02O6A2j26F9tYfDIeUw3eITLTb4yBHsw0RmeSL8tmy2BW?= =?us-ascii?q?W7W9V5InyRjosxX1meJq?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0AxCQAWJZFb/39FF15AGh0BAQUBCwGDT?= =?us-ascii?q?mV/FROMY4tBgg2NKostCAGIHBkGBjQUAQIBAQIBAQEBAWwcDII1IoJiAQU6Tws?= =?us-ascii?q?YCSUPLRuDO4IBBAs0owuKBIpegVg/g3YugxsEGIIUhQsCjT2ONAcCf4EEBIQvi?= =?us-ascii?q?T4iCYF/jF+LMooiIYFVMxonTIJsCYc2gmKGNG0BdAQBjG0BAQ?= X-IPAS-Result: =?us-ascii?q?A0AxCQAWJZFb/39FF15AGh0BAQUBCwGDTmV/FROMY4tBgg2?= =?us-ascii?q?NKostCAGIHBkGBjQUAQIBAQIBAQEBAWwcDII1IoJiAQU6TwsYCSUPLRuDO4IBB?= =?us-ascii?q?As0owuKBIpegVg/g3YugxsEGIIUhQsCjT2ONAcCf4EEBIQviT4iCYF/jF+LMoo?= =?us-ascii?q?iIYFVMxonTIJsCYc2gmKGNG0BdAQBjG0BAQ?= X-IronPort-AV: E=Sophos;i="5.53,338,1531778400"; d="scan'208";a="345247389" Received: from fettunta.org ([94.23.69.127]) by mail2-smtp-roc.national.inria.fr with ESMTP; 06 Sep 2018 15:03:15 +0200 Received: from gargamel.invalid (eduroam-246c.sophia.inria.fr [138.96.49.246]) by fettunta.org (Postfix) with ESMTPSA id 0F500D7FA for ; Thu, 6 Sep 2018 15:03:15 +0200 (CEST) Received: from gares by gargamel.invalid with local (Exim 4.89) (envelope-from ) id 1fxtwI-00033Z-Iy for caml-list@inria.fr; Thu, 06 Sep 2018 15:03:14 +0200 Date: Thu, 6 Sep 2018 15:03:14 +0200 From: Enrico Tassi To: caml-list@inria.fr Message-ID: <20180906130314.ymqnpcxbrz5d7tj4@gargamel> References: <20180906113622.lcuamhs6g6juv2r5@gargamel> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20170113 (1.7.2) Subject: Re: [Caml-list] How to rename a record field Reply-To: Enrico Tassi X-Loop: caml-list@inria.fr X-Sequence: 17052 Errors-to: caml-list-owner@inria.fr Precedence: list Precedence: bulk Sender: caml-list-request@inria.fr X-no-archive: yes List-Id: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On Thu, Sep 06, 2018 at 01:48:23PM +0200, Gabriel Scherer wrote: > MPR#7102: Ability to re-export a variant definition with renamed > constructors? > https://caml.inria.fr/mantis/view.php?id=7102 Thanks for the pointer, but I'm not sure I understand how the arguments made there apply to records. My intuition is that, given that records are compared by name, there should be no difference between adding the equation t = old or casting (with Obj.magic) each and every term of type old to type t. To my knowledge the two records have the very same representation at run time, that does not depend on the names of the fields but just their types. I've even tried to disable the check in typing/includecore.ml around line 230 and the following silly test seems to work. type old = { bad : int; stuff : bool } type t = old = { good : int; stuff : bool } let rb = { bad = 3; stuff = false } let rg = { good = 3; stuff = false } let _ = Printf.printf "%b\n" rb.stuff let _ = Printf.printf "%b\n" rg.stuff let _ = Printf.printf "%d\n" rb.bad let _ = Printf.printf "%d\n" rg.good let _ = Printf.printf "%d\n" rg.bad let _ = Printf.printf "%d\n" rb.good let _ = Printf.printf "%d\n" { rb with good = rb.bad + 1 }.bad let _ = Printf.printf "%b\n" { rb with stuff = not rg.stuff }.stuff Where is my intuition wrong? Why records needs to be compared by name and not by (type) structure? Sorry if the question is silly, but I really don't know. Best, -- Enrico Tassi -- 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