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

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Daniel_Bünzli <daniel.buenzli@e...>
Subject: Re: strong/weak typing terminology (was Re: [Caml-list] Scripting in ocaml)

Le 22 déc. 06 à 19:16, skaller a écrit :

> It is also unclear what you mean by 'unsafe'.
>
> Ocaml is not safe:
>
> 	let a = Array.create 0 0 in
> 	let y = a.[99] in (* WOOPS *)
>
> The fact that an exception is thrown may or may not
> make the language safe depending on whether or not
> you INTEND to trigger an exception. The best you can
> say is that if you don't catch it, its a bug.

I'm sorry I don't follow you. This would be an example of safety  
according to the definition I gave. Ocaml protects its array  
abstraction -- which allows to look at a bounded piece of memory as a  
finite array of values of a certain type -- by raising an exception  
if you try to access out of the bounds of the memory instead of  
silently running the program with the arbitrary data it got by  
reading out of bounds.

Daniel