From: eijiro_sumii@anet.ne.jp
To: caml-list@inria.fr
Cc: Pierre.Weis@inria.fr, sumii@yl.is.s.u-tokyo.ac.jp
Subject: Re: [Caml-list] exceptions and the polymorphic equality
Date: Tue, 17 Jul 2001 09:59:12 +0900 [thread overview]
Message-ID: <20010717095912O.sumii@yl.is.s.u-tokyo.ac.jp> (raw)
In-Reply-To: <200107161511.RAA23787@pauillac.inria.fr>
> On the other hand, the structural equality (=) when applied to
> exceptions and constructors is not completely specified, hence
> unreliable.
I see, this makes sense - indeed, exn is not an equality type in SML.
> You're right, having e <> e' should be desirable. However, in this
> case you should not test structural equality, since it is very likely
> the case that e and e' are represented by the same kind of value. You
> should test identity (==) instead:
>
> # e == e';;
> - : bool = false
>
> That's what the compiler generates when pattern matching exception
> values (more precisely it uses == for the exception constructor and
> regular pattern matching for the rest of the pattern).
Several people have suggested using == instead of =, but doing so
seems even more problematic because:
Objective Caml version 3.01
# exception Foo;;
exception Foo
# Foo == Foo;;
- : bool = false
#
Regards,
Eijiro
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
next prev parent reply other threads:[~2001-07-17 0:59 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-07-15 13:05 eijiro_sumii
2001-07-16 14:44 ` Nils Goesche
2001-07-16 14:58 ` Xavier Urbain
2001-07-16 15:02 ` Xavier Urbain
2001-07-16 15:58 ` Nils Goesche
2001-07-16 15:11 ` Pierre Weis
2001-07-17 0:59 ` eijiro_sumii [this message]
2001-07-17 14:35 ` Nils Goesche
2001-07-18 0:28 ` eijiro_sumii
2001-07-18 13:36 ` Nils Goesche
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=20010717095912O.sumii@yl.is.s.u-tokyo.ac.jp \
--to=eijiro_sumii@anet.ne.jp \
--cc=Pierre.Weis@inria.fr \
--cc=caml-list@inria.fr \
--cc=sumii@yl.is.s.u-tokyo.ac.jp \
/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