"Strong typing vs. strong testing"

Seebs usenet-nospam at seebs.net
Fri Oct 1 12:58:02 EDT 2010


On 2010-10-01, Pascal J. Bourguignon <pjb at informatimago.com> wrote:
> Seebs <usenet-nospam at seebs.net> writes:
>> On 2010-10-01, Pascal J. Bourguignon <pjb at informatimago.com> wrote:
>>> compiler passes wrong type      wrong result        fails at run-time
>>>                                 (the programmer     (with exception
>>>                                 spends hours        explaining this is
>>>                                 finding the         the wrong type)
>>>                                 problem)
>
>> I have no clue what exact scenario you're talking about here.  I've never
>> seen a bug that could plausibly be described as "compiler passes wrong
>> type" which wasn't picked up quickly by running with more warnings enabled.

> This is the scenario discussed in this thread, a long is passed to
> maximum without a compiler warning.

The compiler didn't pass the wrong type, the user did.

>> And on the other end of things, it is not always obvious or straightforward
>> to figure out *why* the dynamic language has ended up with something of the
>> wrong type, or what's wrong with that type.

> It is on the contrary rather obvious or easily discoverable, looking at
> the backtrace, and inspecting the data structures referenced from it.

This is a fascinating assertion, but it is slightly marred by not actually
being generally true.  It's often the case that it's pretty obvious, but
sometimes it's not so obvious -- it can take quite a bit of doing to figure
out how or where some hunk of a data structure got set up wrong.  It's very
easy to find the call where a nil was passed to something expecting some kind
of integer; it's sometimes not so easy to find the completely unrelated hunk
of code which modified the data structure half an hour earlier.

-s
-- 
Copyright 2010, all wrongs reversed.  Peter Seebach / usenet-nospam at seebs.net
http://www.seebs.net/log/ <-- lawsuits, religion, and funny pictures
http://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated!
I am not speaking for my employer, although they do rent some of my opinions.



More information about the Python-list mailing list