"Strong typing vs. strong testing"

Seebs usenet-nospam at seebs.net
Thu Sep 30 15:17:39 EDT 2010


On 2010-09-30, RG <rNOSPAMon at flownet.com> wrote:
> In article <slrnia9fvi.307n.usenet-nospam at guild.seebs.net>,
>  Seebs <usenet-nospam at seebs.net> wrote:
>> And that's the magic of static typing:  It is not a false positive to
>> warn you that "2L" is not of type int.

> We'll have to agree to disagree about that.

No, we won't.  It's the *definition* of static typing.  Static typing
is there to give you some guarantees at the expense of not being able
to express some things without special extra effort.  That's why it's
static.

> The numerical value 2 can 
> safely be represented as an int, so I would consider this a false 
> positive.

That's nice for you, I guess.

The point of static typing is that it makes it possible to ensure that
the values that reach a function are in fact of the correct type -- at
the cost of not being able to rely on free runtime conversions.

If you want to write safe conversions, you can do that.  If you don't
bother to do that, you end up with errors -- by definition.

-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