caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Alain Frisch <alain.frisch@lexifi.com>
To: Gabriel Scherer <gabriel.scherer@gmail.com>
Cc: Leo White <leo@lpw25.net>, caml users <caml-list@inria.fr>
Subject: Re: [Caml-list] exception Foo = Bar.Baz
Date: Wed, 27 Jul 2016 10:07:40 +0200	[thread overview]
Message-ID: <ebddf1c7-9fa5-52c6-c6ec-d1bd748167f9@lexifi.com> (raw)
In-Reply-To: <CAPFanBF8XZqeTHEfy9Ogh0JO_mPzcweynPi-zQxeNWY7TWYpLQ@mail.gmail.com>

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

  reply	other threads:[~2016-07-27  8:07 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-25 14:34 Matej Kosik
2016-07-25 20:02 ` Alain Frisch
2016-07-25 20:05   ` Gabriel Scherer
2016-07-26  9:36     ` Leo White
2016-07-26 12:37       ` Gabriel Scherer
2016-07-26 16:27         ` Alain Frisch
2016-07-26 16:32           ` Gabriel Scherer
2016-07-27  8:07             ` Alain Frisch [this message]
2016-07-27  8:27               ` Gabriel Scherer
2016-07-27  8:38                 ` Alain Frisch
2016-07-27  8:19           ` Leo White
2016-07-26  9:02   ` Matej Kosik
2016-07-26 12:13     ` Gerd Stolpmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ebddf1c7-9fa5-52c6-c6ec-d1bd748167f9@lexifi.com \
    --to=alain.frisch@lexifi.com \
    --cc=caml-list@inria.fr \
    --cc=gabriel.scherer@gmail.com \
    --cc=leo@lpw25.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).