program surgery vs. type safety

dman at dman13.dyndns.org dman at dman13.dyndns.org
Fri Nov 14 19:48:42 CET 2003


On 14 Nov 2003 04:17:08 -0800, Jeremy Fincher wrote:
> Alex Martelli <aleax at aleax.it> wrote in message news:<QAOsb.21403$hV.779611 at news2.tin.it>...
>> Sure,
>> "tests can only show the _presence_ of errors, not their
>> _absence_".  But so can static, compiler-enforced typing -- it
>> can show the presence of some errors, but never the absence of
>> others ("oops I meant a+b, not a-b"! and the like...).
> 
> But it *does* show the absence of type errors,

Not all the time.  Casting (a la C, C++, Java) allows the programmer
to say "silly compiler, you don't know what you're saying" (usually,
it also converts int<->float and such, but apart from that).  That
results in a runtime type error the compiler didn't detect.  A Java
runtime will detect that later, but C and C++ will just behave wrong.

-D

-- 
What good is it for a man to gain the whole world, yet forfeit his
soul?  Or what can a man give in exchange for his soul?
        Mark 8:36-37
 
www: http://dman13.dyndns.org/~dman/            jabber: dman at dman13.dyndns.org




More information about the Python-list mailing list