Optional Static Typing

John Roth newsgroups at jhrothjr.com
Thu Dec 23 19:42:16 CET 2004


"Rocco Moretti" <roccomoretti at hotpop.com> wrote in message 
news:cqf06r$g39$1 at news.doit.wisc.edu...
> John Roth wrote:
>>  One of the comments on Artima asks a rather profound
>> question: static typing is an answer. What's the question?
>> (That's a paraphrase.)
>>
>> The answer that everyone seems to give is that it
>> prevents errors and clarifies the program.
>
> <shrug> It might just be me, but I thought it was to simplify code 
> analysis and compilation. (That is, for the use of static typing in 
> general, not for Python in particular.)
>
> Looking at C, it's doubtful error prevention and program clarification was 
> a serious objective in the static typing system. It's more reasonable to 
> conclude that C is statically typed because it allows the compiler to more 
> easily allocate 1 vs 2 vs 8 bytes for a particular variable, and to make 
> sure the proper addition opcodes get put down.

The C language does not have strong typing in the sense
that most people use the term today.

>
> Now whether this would be useful for Python is an open question.
>
>> Many of the supposed advantages simply aren't there
>> when you go to the discipline of writing a test and then
>> writing exactly the code needed to make the test pass, and
>> not one keystroke more.
> ...
>> This isn't to say TDD is the be-all and end-all of
>> correctness.
>
> Right. And unit tests don't do anything for people who don't use them.

Absolutely correct.

> The question is, should Guido state "TDD is the one true way to program in 
> Python.", or should concessions be made in the language design for those 
> who don't "drink the TDD Kool-aide".

Neither one. I hope you didn't mean  that people
who advocate TDD are suicidal fanatics, because
that's exactly what "drink the  kool-aid" means.

>> So the conclusion here is that static typing is an attempt
>> to make programming safe for people that shouldn't be
>> programming in the first place.
>
> I rebut it thusly: "elitist bastard." <wink and a half>

Bullshit. Where did you get your certificate in mind  reading?

Remember that all of the people who started this were
computer science professors, and most of their experiance was
with computer science students. They were also European
computer science professors with a strong mathematical
tendency; we have since learned that mathematicians and
software developers think differently (see some comments
by Don Knuth to that effect - don't have the reference handy.)

They're the ones who were elitist: they strongly believed
that you had to be a mathematician to be able to properly
program, and that they were doing something good for
the people who weren't fortunate enough to have a
rigorous mathematical background by forcing them into
the strait-jacket of static typing.

Competent professional programmers are a different group,
and need different facilities.

> One of the draws of Python is that it's welcoming to newcomers and 
> programmers of all talents. You don't have to be an "uber-programmer" to 
> use it and use it well. Should we hobble it to suit poor programmers? No. 
> But that's no reason why it can't be made to be easier and safer to use 
> for the hobbyist when it doesn't compromise usefulness for the 
> power-programmer. (My opinion) Python shouldn't have a sign on the door 
> saying: "You must be this 'leet to enter."

And it won't. Python has always had the "consenting adults"
philosophy.

> Will static typing be a boon for Python? Is it necessary? Or is it the 
> trailhead on the road to Hades? <shrug> Only time will tell.

Since it won't happen, I'm not particularly worried about it.
If it does, I'll find another language.

John Roth 




More information about the Python-list mailing list