Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

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 Archives:
Bug reports: FAQ:
Beginner's list: