Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] exceptions and the polymorphic equality
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Nils Goesche <cartan@c...>
Subject: Re: [Caml-list] exceptions and the polymorphic equality
eijiro_sumii@anet.ne.jp writes:

> I have a question about the polymorphic equality and exceptions: it
> seems to me that the behaviour of "=" is counter-intuitive with
> respect to pattern matching of exceptions, for example as follows.
> 
>         Objective Caml version 3.01
> 
> # exception Foo;;
> exception Foo
> # let e = Foo;;
> val e : exn = Foo
> # exception Foo;;
> exception Foo
> # let e' = Foo;;
> val e' : exn = Foo
> # e = e';;
> - : bool = true
> # match e with Foo -> true | _ -> false;;
> - : bool = false
> # try raise e with Foo -> ();;
> Uncaught exception: Foo.
> # 
> 
> I know that the two Foo's above should be distinct, but then shouldn't
> e = e' also return false?  Is this issue well known?

I can't see any ``issue'' here:

# e == e';;
- : bool = false

# try raise e with e -> ();;
- : unit = ()

Isn't that just fine?

Regards,
-- 
Nils Goesche
"Don't ask for whom the <CTRL-G> tolls."

PGP key ID 0x42B32FC9

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