[plt-scheme] Why do folks implement statically typed languages?

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Wed May 30 14:15:09 EDT 2007

On May 30, 2007, at 1:59 PM, Chris Uzdavinis wrote:

> Matthias Felleisen <matthias at ccs.neu.edu> writes:
>> 3. This is what I alluded to in my message using the phrase
>> "unsound." What this means concretely is that
>>   int x
>> in a C++ program is completely totally misleading. Depending on your
>> program, the bits in x may come from a string, a function, combine a
>> bunch of booleans, or what-have-you. It doesn't serve as
>> documentation for maintenance and it certainly doesn't serve as clue
>> during debugging.
> While I'm probably the biggest Scheme proponent in my company, I still
> consider myself a C++ programmer first and foremost, and would like to
> comment your characterization.  Though what you say is true, and it's
> *possible* to do all sorts of evil things with your memory and objects
> in C++, it's also entirely possible to make well-behaved, easy to
> understand C++ code too.  That is, well-written C++ code not
> misleading at all.
> Writing intentionally obscure, type-abusive code is not a trait of a
> good C++ program.

It's not a trait of any good programmer to create such programs.

The problem is NOT that anybody would do such things intentionally.
The problem is that all this happens unintentionally and is NOT
caught by the type checker and the make-it-sound run-time system.

Just think: out-of-bounds errors in security messages from CMU's
CERT are the most common source of problems. I don't doubt for
one moment that the programmers didn't want this.

Finally: my claim is true because a single out-of-bound error
can send random bits on its way to everywhere. C++ contrary
to appearances has no modularity and information hiding construct.
That's insidious, and it is why I point to it as an example of
bad programming language engineering. (That's not true for C.)

-- Matthias

Posted on the users mailing list.