"Strong typing vs. strong testing"

Seebs usenet-nospam at seebs.net
Thu Sep 30 23:24:31 CEST 2010


On 2010-09-30, RG <rNOSPAMon at flownet.com> wrote:
> I don't want to quibble over terminology.

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

> Whatever label you choose to 
> put on it ("false positive", "not being able to express some things 
> without special extra effort") I consider it a deficiency.

Oh, it definitely is a deficiency.

However, the deficiency is that you have to do extra work to get data
safely in, and you have to figure out for yourself how you want to
handle things if, say, you have a value which is not of the right type,
and you want to make it be of the right type, but it may not be possible
to do so.

It is, however, entirely possible to write a function which returns
the maximum of its two inputs, 100% reliably, in C.

> The costs are greater than the benefits.  Reasonable people can
> (and obviously do) disagree.

I tend to think it depends on what I'm trying to do, and why I'm trying
to do it.  There are plenty of tasks for which I prefer C's semantics to
those of most scripting languages -- and others for which I prefer scripting
language semantics.

In practice, I have dozens to hundreds of times more problems with
scripting languages where something ends up being of the wrong type (or more
precisely, not of any of the types which can be used in that context) than I
have, say, overflow problems in C.  On the other hand, it's usually much
easier to catch them and deal with them.

-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