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 ESMTP id CDC855D4 for ; Thu, 6 Sep 2018 11:40:09 +0000 (UTC) X-IronPort-AV: E=Sophos;i="5.53,337,1531778400"; d="scan'208,217";a="345228113" Received: from sympa.inria.fr ([193.51.193.213]) by mail2-relais-roc.national.inria.fr with ESMTP; 06 Sep 2018 13:40:07 +0200 Received: by sympa.inria.fr (Postfix, from userid 20132) id AE5EA824B2; Thu, 6 Sep 2018 13:40:07 +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 A6BDC824B2 for ; Thu, 6 Sep 2018 13:39:53 +0200 (CEST) Authentication-Results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=gabriel.scherer@gmail.com; spf=Pass smtp.mailfrom=gabriel.scherer@gmail.com; spf=None smtp.helo=postmaster@mail-lj1-f172.google.com IronPort-PHdr: =?us-ascii?q?9a23=3A8Q1V8xXtPFveIUOKmE8ahFh7Si/V8LGtZVwlr6E/?= =?us-ascii?q?grcLSJyIuqrYbRCBt8tkgFKBZ4jH8fUM07OQ7/i/HzRYqb+681k6OKRWUBEEjc?= =?us-ascii?q?hE1ycBO+WiTXPBEfjxciYhF95DXlI2t1uyMExSBdqsLwaK+i764jEdAAjwOhRo?= =?us-ascii?q?LerpBIHSk9631+ev8JHPfglEnjWwba9wIRmssQndqtQdjJd/JKo21hbHuGZDdf?= =?us-ascii?q?5MxWNvK1KTnhL86dm18ZV+7SleuO8v+tBZX6nicKs2UbJXDDI9M2Ao/8LrrgXM?= =?us-ascii?q?TRGO5nQHTGoblAdDDhXf4xH7WpfxtTb6tvZ41SKHM8D6Uaw4VDK/5KpwVhTmlD?= =?us-ascii?q?kIOCI48GHPi8x/kqRboA66pxdix4LYeZyZOOZicq/Ye94VQndPXttKVyxZHIyz?= =?us-ascii?q?c5cPAeQGPeZdtYb9pl0Opga6CQSjAO7jzzlFjWL006InyeQsCQ7J3AIiENwOvn?= =?us-ascii?q?rar8j7OrkOXu2u1qbE0S/OYulK1Tvh6oXFdA0qr/GWXbJ3dMrc0UghGBnegVWK?= =?us-ascii?q?qIzqITeV3fkQvWeH7+pvS/ivhHA9qwpspTWvyd0jhZLThoIU1F/E8T91wJ0pKt?= =?us-ascii?q?24VkF7e8CrEIFLuiGVMot5WMIiQ2VytCkmzb0GvIe2cS4Xw5opwB7fbuaIc4mO?= =?us-ascii?q?4h/7VeaRJy14hHN/d76liRay61Csy+3mWcm011ZKqTBJncXLtnAI0RHY98uJSu?= =?us-ascii?q?Nl80u/xTqC0xrf5+JELEwui6bXN50szqQtmpcRr0jOGDL9ll/sg6+MbEok//Cl?= =?us-ascii?q?6+T5bbXioZ+RL4p0hRv/MqQqg8C/BeY4PhUXU2iV5Oix1qPv8Vf2QLVNif02na?= =?us-ascii?q?3Zv47AKcsHoa65BhdZ0ocl6xmhEzeryMoUkWUDIV5fex+Kj5LlN0/SLP37F/uz?= =?us-ascii?q?nlahnClzy/DDJLLhA5HNLnbZkLfmeLZw80FcxxAowtBF5pJbFLUBLOjoWkDttN?= =?us-ascii?q?zXEAU5PBKuw+v8B9V905kRWWOLAqODLKzStlqI6vo1I+aQfI8VpCr9K/896v7y?= =?us-ascii?q?l3A5gkQdfaiy0JoWaXC4G+9pI1+Dbnb2g9cBF30KvgskQ+Dwhl2CSyZZZ2yuUK?= =?us-ascii?q?Ik+jE7FIWmAJ/fSY+3hbyB2D63HplXZmBdFlCBCmzodoWBW/cUci2eOM5hkjoe?= =?us-ascii?q?VbigUYAtzx+utBWpg4Zge8fS4CwTstrf3cNu5qWHmBco9DdzSdiUyHqMZ2ByhG?= =?us-ascii?q?IBATEsivNRu0t4n3iK27J5jvgQLtdT6ulESE9uOpfW1e13D5bpUQLMZNqTYFmj?= =?us-ascii?q?S9SiRzo2S4RikJc1f09hFoD63Vj41C2wDupQyuXSVc4Et5nE1n20HP5TjnPP1a?= =?us-ascii?q?0vlV4jG5IdOmivh6o5/A/WVdeQzxep0p2yfKFZ5xbjsX+ZxDPX7k5dWQ90F67C?= =?us-ascii?q?WCJHPxaEnZHC/krHCoSWJ/EnPw9Gk5DQL6JLbpjtjwwDSq68YpLRZGW+n2r2Dh?= =?us-ascii?q?GNlOuB?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0AaCQANEZFbhqzQVdFAGh4BBgyDckF/K?= =?us-ascii?q?INygR2CWpBMgg0CgleGd4xzgWYLI4RJAoNXGQcBBDQUAQIBAQIBAQEBARMBAQE?= =?us-ascii?q?ICwsIGw4jDII1JIJgAQQBIx0BGxILAQMBCwYFBAcaHQICIgERAQUBChIGEwgKg?= =?us-ascii?q?w8BgWgBAw0IDzSWCDyLC4ERBQEXgnYFg2YKGSYDCleBbwIGEopMgVg/g3YugxA?= =?us-ascii?q?LBBiBD2WCVIJXAoZiCJUHBwKCAwSEL4lJF4IIjF+LMog7DyGBECeBdjMaI1Axg?= =?us-ascii?q?jsJghAag06BPokWPTABjWYBAQ?= X-IPAS-Result: =?us-ascii?q?A0AaCQANEZFbhqzQVdFAGh4BBgyDckF/KINygR2CWpBMgg0?= =?us-ascii?q?CgleGd4xzgWYLI4RJAoNXGQcBBDQUAQIBAQIBAQEBARMBAQEICwsIGw4jDII1J?= =?us-ascii?q?IJgAQQBIx0BGxILAQMBCwYFBAcaHQICIgERAQUBChIGEwgKgw8BgWgBAw0IDzS?= =?us-ascii?q?WCDyLC4ERBQEXgnYFg2YKGSYDCleBbwIGEopMgVg/g3YugxALBBiBD2WCVIJXA?= =?us-ascii?q?oZiCJUHBwKCAwSEL4lJF4IIjF+LMog7DyGBECeBdjMaI1AxgjsJghAag06BPok?= =?us-ascii?q?WPTABjWYBAQ?= X-IronPort-AV: E=Sophos;i="5.53,337,1531778400"; d="scan'208,217";a="345227964" Received: from mail-lj1-f172.google.com ([209.85.208.172]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/AES128-GCM-SHA256; 06 Sep 2018 13:39:52 +0200 Received: by mail-lj1-f172.google.com with SMTP id v9-v6so9036363ljk.4; Thu, 06 Sep 2018 04:39:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=OMyNxF65QQgmSyquUhT+IbnwveXP1BRZ0t8ZAny7F9Y=; b=ecDoaP4e0lgjgNF4lsklr9+x4ef2fDtDiZOn6xTZorEL4QDkxkORdqT0vYA3LMDV2i l539a5HXEdwYsAwZ95ASYI0Gan2r2VEAPN5/jg66xDvvNZPNRUN5n/oiHUNF1vmt/6gx Ir4UMYI6Ud7mePEz2IDX4zA8scmgpTuJyPDrMtYQga+DQnjQ0/IJtnYpwsGYYz/hkWMM Oi5TdLFWNTcOYo17dqtnAVKGUh/cOELcBEhC5MwmBbbzzOK28n0TNJAYgQvBsA+sKEXz UO+F6NGxUYXyAb54SFKwOXv9e0O1jIO1WY4/gOa4G3i3VboMKUbUjS8rbZPjJ3vjt7f/ vIDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=OMyNxF65QQgmSyquUhT+IbnwveXP1BRZ0t8ZAny7F9Y=; b=Jh4NeVag60IscKwxOAHUcbb1/95JamfYlTkKZ9ouQAK9LUQbGq02ffAz3mvhE0XBaA EaqSOz9bdsXdqLJSrhcRLiL1ZA8xkznTH3C/Ho3KfXwl8qyOb9NTWMGBO+zDuiODtTbM veklDwoG9MDRiUwZkv+RAqD1dQlfnEwDafgvgZ7bglENFidKSpmjjFuytXN6tgtDbYKr bB9HcVQCytHHfrQvo5LroM0bctin2J8h1yNMt29hSxkqBF0hIjJnNvfer6oZcdwRz4wL ja3RGOlPXT4VSSxt7EK+KX6BlQUaEMmKyED56Dgg8eQJMByOmvrneKuyT6ehtGNUGNge GjIA== X-Gm-Message-State: APzg51BRSNA9CneZxRNC5HhrQoq0k4QyvdONajmApNhmjGZ9rI/rYJTn UutrTi14PomBPiNcPZ7fCz1z492nRakSMQZkrwBpyOQB X-Google-Smtp-Source: ANB0VdYcklVwP97PPHmXxAkI58WmVnaeoN2Lkns5GWm1v/urRen2rvAPVPHfwz9UILCdQaj7Zjld00WKaWDDfSZnC9U= X-Received: by 2002:a2e:998e:: with SMTP id w14-v6mr1617724lji.7.1536233991899; Thu, 06 Sep 2018 04:39:51 -0700 (PDT) MIME-Version: 1.0 References: <20180906113622.lcuamhs6g6juv2r5@gargamel> In-Reply-To: <20180906113622.lcuamhs6g6juv2r5@gargamel> From: Gabriel Scherer Date: Thu, 6 Sep 2018 13:48:23 +0200 Message-ID: To: Enrico Tassi Cc: caml users Content-Type: multipart/alternative; boundary="000000000000610fe205753259be" Subject: Re: [Caml-list] How to rename a record field Reply-To: Gabriel Scherer X-Loop: caml-list@inria.fr X-Sequence: 17051 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: --000000000000610fe205753259be Content-Type: text/plain; charset="UTF-8" A couple years ago I had a similar feature request for variant (sum) constructors, and Jacques Garrigue explained that it is in fact quite difficult. (The reasons apply to record fields as well.) I suspect that you are out of luck. MPR#7102: Ability to re-export a variant definition with renamed constructors? https://caml.inria.fr/mantis/view.php?id=7102 On Thu, Sep 6, 2018 at 1:36 PM Enrico Tassi wrote: > Dear caml-list, while refining an API I felt the need to rename a record > field. I'd like to be nice to my users and have the API evolve without > breaking compilation but eventually emitting deprecation warnings. > > What I'd like to do, concretely is to move from this > > record t = { bad : int; stuff : ty } > > to > > record old = { bad : int [@deprecated "use good"]; stuff : ty } > record t = old = { good : int; stuff : ty } > > The last line does not type check since old and good are different > names. What I'd like to obtain is to have bad and good act as synonyms, > and have OCaml generate a warning when bad is used. > > This is pretty much what you would do for a function: leave the old one > in place and stick a deprecate attribute to it. > > Is there a way to achieve that for records? > > 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 > -- 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 --000000000000610fe205753259be Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
A couple years ago I had a similar f= eature request for variant (sum) constructors, and Jacques Garrigue explain= ed that it is in fact quite difficult. (The reasons apply to record fields = as well.) I suspect that you are out of luck.

=C2= =A0 MPR#7102: Ability to re-export a variant definition with renamed constr= uctors?

On Thu, = Sep 6, 2018 at 1:36 PM Enrico Tassi <enrico.tassi@inria.fr> wrote:
Dear caml-list, while refining an API I felt the need to rename a r= ecord
field. I'd like to be nice to my users and have the API evolve without<= br> breaking compilation but eventually emitting deprecation warnings.

What I'd like to do, concretely is to move from this

=C2=A0 record t =3D { bad : int; stuff : ty }

to

=C2=A0 record old =3D { bad : int [@deprecated "use good"]; stuff= : ty }
=C2=A0 record t =3D old =3D { good : int; stuff : ty }

The last line does not type check since old and good are different
names. What I'd like to obtain is to have bad and good act as synonyms,=
and have OCaml generate a warning when bad is used.

This is pretty much what you would do for a function: leave the old one
in place and stick a deprecate attribute to it.

Is there a way to achieve that for records?

Best,
--
Enrico Tassi

--
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/ocam= l_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs
--000000000000610fe205753259be--