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:38:20 +0200	[thread overview]
Message-ID: <22f40288-b8ca-6b16-f9c8-735ceb1d2617@lexifi.com> (raw)
In-Reply-To: <CAPFanBFxGOVUup8yXpvkDYBXmn019Cboaeeu_C+EFBSZF3wniQ@mail.gmail.com>

On 27/07/2016 10:27, Gabriel Scherer wrote:
> You can already eliminate one of the two comparisons if both A are
> statically known to be the same.

You could check if A is equal B on the raise site and jump to the 
correct handler depending on the result, but this approach could in 
general produce much bigger code (you need to check equality with all 
intermediate exception constructors with the same arity on each such raise).

> 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.

Indeed, good point.

Thanks also to Leo for providing a good use case (renaming on functor 
boundaries).

Alain

  reply	other threads:[~2016-07-27  8:38 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
2016-07-27  8:27               ` Gabriel Scherer
2016-07-27  8:38                 ` Alain Frisch [this message]
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=22f40288-b8ca-6b16-f9c8-735ceb1d2617@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).