"Strong typing vs. strong testing"

Keith Thompson kst-u at mib.org
Thu Sep 30 08:00:56 CEST 2010

RG <rNOSPAMon at flownet.com> writes:
> In article <lnbp7g58b4.fsf at nuthaus.mib.org>,
>  Keith Thompson <kst-u at mib.org> wrote:
>> Even here, maximum() did exactly what was asked of it.
> Of course.  Computers always do only exactly what you ask of them.  On 
> this view there is, by definition, no such thing as a bug, only 
> specifications that don't correspond to one's intentions.  
> Unfortunately, correspondence to intentions is the thing that actually 
> matters when writing code.

Of course there's such a thing as a bug.

This version of maximum:

    int maximum(int a, int b) {
        return a > b ? a : a;

has a bug.  This version:

    int maximum(int a, int b) {
        return a > b ? a : b;

I would argue, does not.  The fact that it might be included in a
buggy program does not mean that it is itself buggy.


> I'm not saying one should not use compile-time tools, only that one 
> should not rely on them.  "Compiling without errors" is not -- and 
> cannot ever be -- be a synonym for "bug-free."

Agreed.  (Though C does make it notoriously easy to sneak buggy code
past the compiler.)

Keith Thompson (The_Other_Keith) kst-u at mib.org  <http://www.ghoti.net/~kst>
"We must do something.  This is something.  Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"

More information about the Python-list mailing list