From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id CAA31719; Tue, 17 Jul 2001 02:59:21 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id CAA31790 for ; Tue, 17 Jul 2001 02:59:19 +0200 (MET DST) Received: from espresso (espresso.is.s.u-tokyo.ac.jp [133.11.12.104]) by concorde.inria.fr (8.11.1/8.10.0) with ESMTP id f6H0xGT16436; Tue, 17 Jul 2001 02:59:17 +0200 (MET DST) Received: from espresso ([127.0.0.1] helo=localhost ident=sumii) by espresso with esmtp (Exim 3.12 #1 (Debian)) id 15MJCj-00076Q-00; Tue, 17 Jul 2001 09:59:13 +0900 To: caml-list@inria.fr From: eijiro_sumii@anet.ne.jp Cc: Pierre.Weis@inria.fr, sumii@yl.is.s.u-tokyo.ac.jp Subject: Re: [Caml-list] exceptions and the polymorphic equality In-Reply-To: <200107161511.RAA23787@pauillac.inria.fr> References: <20010715220500D.sumii@yl.is.s.u-tokyo.ac.jp> <200107161511.RAA23787@pauillac.inria.fr> X-Mailer: Mew version 1.94.2 on Emacs 20.7 / Mule 4.1 (AOI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-Id: <20010717095912O.sumii@yl.is.s.u-tokyo.ac.jp> Date: Tue, 17 Jul 2001 09:59:12 +0900 X-Dispatcher: imput version 991025(IM133) Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk > 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