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] Q: safe language
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2002-08-30 (15:56)
From: Vitaly Lugovsky <vsl@o...>
Subject: Re: [Caml-list] Q: safe language
On 30 Aug 2002, David Frese wrote:

> > > >  (cadr '(1))
> > > 
> > > This shows that Lisp is safe, because it results in an error, and does
> > > not return some value from out of nowhere (or does it).
> > 
> >  No. In this place program may be expecting some structure, which can 
> > contain NIL. There is no other way in lisp to define structures - so, any
> > code accepting lists will accept any alien structure. Is is type safety? 
> If you are refering to the fact, that the expression above returns NIL,
> then yes, this is no type-safety, and a very bad thing - I did not know
> that.

 It depends on the Lisp implementation. But, you can find a lot of 
"unsafe" examples with correct behavior: e.g. 3-d vector passed as 2-d 
vector, and lisp function working with structures using only cars and 
cdrs will not fail with it.

> > No way! Dynamically typed languages can't be safe.
> I don't think this is a problem of dynamic or static typing, but a mad
> behaviour of Lisp.

 With polymorphism and dymanic typing the programm may not fail at the 
point where wrong type was passed - and this is "unsafe" behaviour (this 
is where I have an ugly headache with Java).
Statically typed language will not allow potentially unsafe function 

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: