[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Strong Typing, Dynamic Languages, What to do?



Chris Uzdavinis:


> A vector of 5 elements is the same type as a vector of 6 elements.
> The type of the vector is not a function of its size.  Adding a new
> element doesn't change the type of the vector.  You can go out of
> bounds on a vector, but that's not due to type checking, it is due to
> range checking... two orthogonal concepts, IMHO.

Niclaus Wirth wouldn't agree. At all. Canonical Pascal arrays include
range in their types. (Some functional languages as well, of course.)
There is nothing really orthogonal here, the validity of input is 
a "contract" which has many faces. 


> Also, you are assuming that every access in C++ is unsafe, or that for
> every potentially unsafe access some validating abstraction has to be
> written.  Sometimes it comes in handy, but if you write code that
> depends on range checking, I'd claim that the program is seriously
> buggy.

If you do it for sheer pleasure, perhaps. If you write a portable
library module which can be used by anybody, including the most unreliable
programmers in the world, the story is much different. 


> I like Scheme very much, but there is no possible way that such a
> language could possibly keep up with the volume of data that my C++
> code handles so elegantly.
> 
> (In all honesty, I'd be thrilled to be able to have written these
> programs in Scheme, but it's just too slow to be practical.)


Look, I don't know you, and I don't want to raise any questions about 
your competence, seriously, with full respect. But I have seen such
statements hundreds times. Practically *ALWAYS* people who said that, never
tried.


Jerzy Karczmarczuk
Caen, France