Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Uncaught exceptions (or am I going crazy?)
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Didier Le Botlan <lebotlan@b...>
Subject: Re: [Caml-list] Uncaught exceptions (or am I going crazy?)
( << J'ai ! >> )

Try this one :

let arr = Array.create 5 " a cell "
let _ = print_string arr.(0) ; print_string arr.(10) ;;   


I get << a cell Fatal error: exception Invalid_argument("Array.get") >>
It's a feature ! Reading a cell outside an array raises an exception and
prints it on the screen.
Similarly, when a pipe is closed, a system exception is raised.
Since you do not catch the exception with a 'try ... with Sys_error m ->
...' block, you get the message on stderr, that is on your screen.

Does it answer your question ?


"Yaron M. Minsky" a écrit :
> 
> I'm getting some very weird behavior ...
> What's so strange about this is that as far as I can tell, there is no
> place in my code where I actually print out such errors.
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners