Version française
Home     About     Download     Resources     Contact us    
Browse thread
Strange performances
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Jon Harrop <jon@f...>
Subject: Re: [Caml-list] Strange performances
On Friday 18 January 2008 17:05:20 Olivier Andrieu wrote:
> Salut,
>
> On Jan 18, 2008 5:55 PM, Benjamin Canou <benjamin.canou@gmail.com> wrote:
> > This code works perfectly :
> >
> > let list_of_string s =
> >   let rec list_of_string s i =
> >     try let e = s.[i] in e :: list_of_string s (succ i)
> >     with Invalid_argument "index out of bounds" -> []
> >   in list_of_string s 0
>
> well, until you compile with the -unsafe flag ....

That is an argument against the -unsafe flag rather than against the above 
code, IMHO. None of the operations used here were unsafe and, in an ideal 
world, OCaml would never segfault on this safe code.

I _really_ don't like the notion that OCaml can just screw up following out of 
bounds access because that is one of the main reasons I migrated to OCaml in 
the first place...

-- 
Dr Jon D Harrop, Flying Frog Consultancy Ltd.
http://www.ffconsultancy.com/products/?e