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: skaller <skaller@u...>
Subject: Re: strong/weak typing terminology (was Re: [Caml-list] Scripting in ocaml)
On Fri, 2006-12-22 at 19:47 +0100, Daniel Bünzli wrote:
> 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.

This is not my understanding of what safe means.

Your program is safe? Ok, so would you use it to
control a nuclear reactor? Do you really think anyone
cares if the reactor blows, whether the program
core dumped, failed to core dump, or threw an exception?

to me safe means 'cannot fail'. But perhaps i misunderstand:
it would be interesting to see another definition.


-- 
John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net