[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Johann Spies <jspies@s...> |
| Subject: | Re: [Caml-list] question on exceptions |
On Fri, May 13, 2005 at 03:34:22PM +0200, Julien Verlaguet wrote:
> I have the following peace of code
>
> exception E;;
> let x=E;;
> exception E;;
>
> I don't understand why the two following things are not equivalent :
>
> # x=E;;
> - : bool = true
>
> # match x with
> | E -> true
> | _ -> false;;
> - : bool = false
>
> Is this normal ?
Maybe. I am no expert but I suspect the second "exception E;;" causes
the behaviour that you saw. Look at this:
# exception E;;
let x=E;;
exception E;;
exception E
# val x : exn = E
# exception E
# x=E;;
- : bool = true
# match x with
| E -> true
| _ -> false;;
- : bool = false
So far it is the same, but
# exception E;;
exception E
# let x=E;;
val x : exn = E
# x=E;;
- : bool = true
# match x with
| E -> true
| _ -> false;;
- : bool = true
Regards
Johann
--
Johann Spies Telefoon: 021-808 4036
Informasietegnologie, Universiteit van Stellenbosch
"In my Father's house are many mansions: if it were not
so, I would have told you. I go to prepare a place for
you. And if I go and prepare a place for you, I will
come again, and receive you unto myself; that where I
am, there ye may be also." John 14:2,3