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 mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id D92A97FDE1 for ; Wed, 27 Jul 2016 10:27:56 +0200 (CEST) IronPort-PHdr: 9a23:PdY1ThG84+TDnwJRoMsw4J1GYnF86YWxBRYc798ds5kLTJ75oMmwAkXT6L1XgUPTWs2DsrQf2rKQ7f2ocFdDyK7JiGoFfp1IWk1NouQttCtkPvS4D1bmJuXhdS0wEZcKflZk+3amLRodQ56mNBXsq3G/pQQfBg/4fVIsYL+kQsiM0oye7KObw9XreQJGhT6wM/tZDS6dikHvjPQQmpZoMa0ryxHE8TNicuVSwn50dxrIx06vru/5xpNo8jxRtvQ97IYAFPyiJ+VrBYBfWR0iOmEzrOPxtALITUPb738VU2NQnABJGAPFxBX3Tpb/s23xse8riweAOsijYrk+QzWv6+9QQx/lkiodf2o2+WvNi8F0yrlQoB+7qgZXzIvdYYXTP/17KPCONegGTHZMC54CHxdKBZmxOs5WV7IM 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-it0-f54.google.com Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of gabriel.scherer@gmail.com) identity=pra; client-ip=209.85.214.54; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="gabriel.scherer@gmail.com"; x-sender="gabriel.scherer@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of gabriel.scherer@gmail.com designates 209.85.214.54 as permitted sender) identity=mailfrom; client-ip=209.85.214.54; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="gabriel.scherer@gmail.com"; x-sender="gabriel.scherer@gmail.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-it0-f54.google.com) identity=helo; client-ip=209.85.214.54; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="gabriel.scherer@gmail.com"; x-sender="postmaster@mail-it0-f54.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0CjAACOb5hXhjbWVdFEEQmEFXwGrTWLQoF9JIV5AoEoBzgUAQEBAQEBAQERAQEBCAsLCRkvgjIEARIBghMBBRIRBBkBGx0BAwwGBQsNAgImAgIiAREBBQEcBhMih3QBAxcOLZ56gTI+MYs7gWqCWgWELAoZJw1Ugz4BAQEBAQEEAQEBAQEBGQIGEHGFKYRNhBmDKIJaAQSOFYscgWCEOIhkgjqNBYc3hHaCORIegQ8egleBcyAyAYhAAQEB X-IPAS-Result: A0CjAACOb5hXhjbWVdFEEQmEFXwGrTWLQoF9JIV5AoEoBzgUAQEBAQEBAQERAQEBCAsLCRkvgjIEARIBghMBBRIRBBkBGx0BAwwGBQsNAgImAgIiAREBBQEcBhMih3QBAxcOLZ56gTI+MYs7gWqCWgWELAoZJw1Ugz4BAQEBAQEEAQEBAQEBGQIGEHGFKYRNhBmDKIJaAQSOFYscgWCEOIhkgjqNBYc3hHaCORIegQ8egleBcyAyAYhAAQEB X-IronPort-AV: E=Sophos;i="5.28,428,1464645600"; d="scan'208";a="228093774" Received: from mail-it0-f54.google.com ([209.85.214.54]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/AES128-GCM-SHA256; 27 Jul 2016 10:27:56 +0200 Received: by mail-it0-f54.google.com with SMTP id u186so137206800ita.0 for ; Wed, 27 Jul 2016 01:27:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=LzTm9UVDDB0W+7t2gVBLTvc3I3KaN2FCDRPJ32mlTWE=; b=RKQQxROmJYQF087DCX6PoaE5EJbfttl/0FvDQmcSUlJx9kRgLYO2fuculrfudrYxOI eFmDGZNuzOVk0z3FbWtrNTUHe9m3ndLf6ESbtw3LKJMvaXW6POAVRiIKrCkci6R4O/dS m6aEwKaC3QC01vZALlAqhSsoBMTmIiss50BoiW0nZyUGR00UwdIIpXgVfptSZFw5px05 6pftasgbgwGIVhT8QA+xhahDcXbTIHoYRzqge2zSHiyjfyNfEMc1PHZE1Wy/9LwZ+shw HjsTJARqS41bJijFQ3jYC8tkyCb3tTkEJJuZWGoaEetBCCqeoCpsY823wSu48XtmO97P vFLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=LzTm9UVDDB0W+7t2gVBLTvc3I3KaN2FCDRPJ32mlTWE=; b=MbERHBzpyMFmXtahqbUleSdbYw6ev96S3z9ZRbNdsJ2nMsvNsTyKKGIVhd7qmKcmtj n4NTi2+CYwZazZURKm55cTzEXgFALs4ilgnkUWRN33XRmsSwZvakS1AYhv7IDyoqFmTL 1QWK0nvu9Dhl4KElrGieZIdwlBK/3gY/wqHKTsQOtzr/VHwFlTFgdMeAjDGPzbzjGj1h pol1/KfH1i9/1ABog9z2qADZV1P3u+P0BQ36XnFmgQMSDordkIeFUcTCU9cnFsqvg1kp 8xUtDbMPdk0h8VX13gOcXUu65iX1DSGdQTsSQtlNg7FNLCyRtqtf1fPIoSYRpGvg3xNg F17w== X-Gm-Message-State: ALyK8tKGBd2WES5qP4a9a+H49YBj/YiepHIWD9E+puGp8a3KazNUecwRSdZcoPO1AuqEmUlMNOjmOgccqQsEpQ== X-Received: by 10.36.124.67 with SMTP id a64mr46800401itd.21.1469608074583; Wed, 27 Jul 2016 01:27:54 -0700 (PDT) MIME-Version: 1.0 Received: by 10.79.20.67 with HTTP; Wed, 27 Jul 2016 01:27:15 -0700 (PDT) In-Reply-To: References: <64e8e1be-7081-d683-e777-6f377968f36c@gmail.com> <07e4f1d2-f61f-4047-b1a0-7339b78825e3@lexifi.com> <1469525797.2529112.676963937.25E14FD6@webmail.messagingengine.com> <14e4dd61-7ff6-fdef-c103-a33c4f728bd9@lexifi.com> From: Gabriel Scherer Date: Wed, 27 Jul 2016 04:27:15 -0400 Message-ID: To: Alain Frisch Cc: Leo White , caml users Content-Type: text/plain; charset=UTF-8 Subject: Re: [Caml-list] exception Foo = Bar.Baz You can already eliminate one of the two comparisons if both A are statically known to be the same. Moreover, cross-module optimization information is likely to give you the actual definition of both A and B -- if they are just defined with either "exception Foo" or "exception Bar = Baz" as a structure item of the compilation unit level, their identity will be known. In the complex cases where it is not (functor parameters, inclusion of a first-class module, etc.), the cost corresponds to some extra expressiveness for the user that I think is worth it. On Wed, Jul 27, 2016 at 4:07 AM, Alain Frisch wrote: > On 26/07/2016 18:32, Gabriel Scherer wrote: >> >> I would see some use in being able to rename variant constructors, see >> >> MPR#7102: Ability to re-export a variant definition with renamed >> constructors? >> http://caml.inria.fr/mantis/view.php?id=7102 > > > The fact that an expression "A = B" can evaluate to true can be confusing > and really change the interpretation of constructors as atoms. It's already > the case for exceptions/extension constructors, but I'd prefer to have less > of it than more. > > Thinking more about it, even for exceptions, not allowing different name for > the same constructor could be useful to optimize cases such as: > > > try > > try > .... > raise A > ... > with B -> ... > > with A -> .... > > > If the compiler could assume that A and B were different constructors, it > could compile the "raise" to a static jump to the handler for A, removing > two dynamic comparisons with exception slots (and their associated memory > accesses). > > > Alain