"Strong typing vs. strong testing"

RG rNOSPAMon at flownet.com
Fri Oct 1 01:49:24 EDT 2010


In article <slrniaa0gi.6t7.usenet-nospam at guild.seebs.net>,
 Seebs <usenet-nospam at seebs.net> wrote:

> On 2010-09-30, RG <rNOSPAMon at flownet.com> wrote:
> > That gives (what I would consider to be) false positives, e.g.:
> 
> > [ron at mighty:~]$ cat foo.c
> 
> > void foo(long x) {}
> 
> > int main() { foo(1); }
> > [ron at mighty:~]$ gcc -Wconversion foo.c
> > foo.c: In function ???main???:
> > foo.c:4: warning: passing argument 1 of ???foo??? with different width due 
> > to prototype
> 
> But it's *not* a false positive.  The compiler is not claiming that the
> conversion couldn't be done -- it's just telling you that there is a
> change of type going on.

Again, you can't have it both ways.  Either a warning is a "compiler 
error" according to the claim at issue (see below) or it is not.  If it 
is, then this is a false positive.  If it is not, then my previous 
example refutes the claim.

> If you don't want that message, it is certainly possible to write code
> which won't get it, and which will reliably work everywhere.

Of course it's possible.  It's *possible*, with enough effort, to write 
correct code in any programming language.  What does that have to do 
with anything?

> > So you have to choose your compiler 
> > (and flags) first, and then I get to construct my example.  If my 
> > example has *either* an error that the compiler doesn't catch *or* a 
> > non-error that it does catch then I win.
> 
> Those goal posts are sorta red shifted at this point.

At this point I would like to quote a wise man who once said:

> May I suggest that, if you don't want to use words and terminology
> precisely, perhaps computer programming is not for you?

Red shifted?

> You're redefining "error" and "non-error" so as to demand that a statically
> typed language offer you the same semantics of errors and non-errors that
> dynamically typed languages have.  That's cheating, though.  The claim
> is about C, not about what people who are expecting a dynamically typed
> language would like C to be like.

The claim is:

http://groups.google.com/group/comp.lang.lisp/msg/431925448da59481

        Message-ID: 
<0497e39d-6bd1-429d-a86f-f4c89babe1a4 at u31g2000pru.googlegroups.com>
        From: TheFlyingDutchman <zzbbaadd at aol.com>
        Newsgroups: comp.lang.lisp

        [...]
        in C I can have a function maximum(int a, int b) that will always
        work. Never blow up, and never give an invalid answer. If someone
        tries to call it incorrectly it is a compile error.
        [...]

The truth of this claim hinges on the definitions of "work", "never blow 
up", "invalid", "call incorrectly" and "compile error."  Define these 
however you like, the result will be that the claim is either false or 
vacuous.

rg



More information about the Python-list mailing list