"Strong typing vs. strong testing"

Pascal J. Bourguignon pjb at informatimago.com
Fri Oct 1 18:18:59 CEST 2010

Seebs <usenet-nospam at seebs.net> writes:

> On 2010-10-01, Pascal J. Bourguignon <pjb at informatimago.com> wrote:
>>                                 static              dynamic
>> compiler detects wrong type     fail at compile     fails at run-time
>>                                                     (with exception
>>                                                     explaining this is
>>                                                     the wrong type)
> Unless, of course, the "wrong type" happens to be compatible enough to
> pass.  In which case, it's unclear whether it is the "wrong type" or not.
>> 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.

> 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.

__Pascal Bourguignon__                     http://www.informatimago.com/

More information about the Python-list mailing list