Python from Wise Guy's Viewpoint

Pascal Costanza costanza at web.de
Sun Oct 26 18:19:50 EST 2003


Dirk Thierbach wrote:

>>I think you have a restricted view of what "type" means. 
> 
> 
> Maybe. It sure would help if you'd tell me your view instead of having
> me guess :-) For me, a type is a certain class of values, and a static
> type is given by a limited language describing such classes. A
> dynamic type is a tag that is associated with a value. Arbitrary
> classes of values (like "all reals less than 200") are not a type.

What are "non-arbitrary classes of values"?

According to your criteria, (real * 200) is
- a certain class of values
- given in a limited language describing that class

I would be interesting to see a convincing definition of the term "type" 
that precludes (real * 200), and similar type specifications.

Most of your other comments depend on this, so I don't comment on them 
in detail.

(Maybe it helps to explain that CHECK-TYPE doesn't check a value per se. 
(check-type 5 (real * 200)) doesn't work. CHECK-TYPE checks a property 
of the variable it is being passed.)

> >>P.S.: Please always remember the original setting of this thread. The
>>original original questions was something along the lines of "why on 
>>earth would one not want a static type system?" 
> 
> The answer to this is of course "You use what you like best. End of
> story."

Fine. (Really.)

> What I wanted to do was to show that the claim "There are things that
> are easy to do in a dynamically typed language, but one cannot do them
> conveniently in a statically typed language, because they won't
> typecheck. Hence, statically typed languages are less expressive" is
> wrong in all but very very rare situations. Of course the amount of
> convenience with which you can do something varies from language to
> language, and with the available libraries, but static typing (if done
> properly) is never a show-stopper.

"very rare situations"
"never a show-stopper"

How do you know?

If you are only talking about your personal experiences, that's fine, 
but you should say so.

>>Yes, you can clearly tell from my postings that I prefer dynamic typing 
>>over static typing. 
> 
> And that's fine with me. What I am a bit allergic to is making
> unjustified general claims about static typing (or any other things,
> for that matter) that are just not true.

The only claim I make is that static type systems need to reject 
well-behaved programs. That's an objective truth.

This implies that there is a trade-off involved. That's also an 
objective truth.

You choose to downplay the importance of dynamic type checking. All I 
hear is that you (and many others) say that the disadvantages of static 
typing are negligible. However, I haven't found any convincing arguments 
for that claim. This claim is simply repeated again and again and again, 
ad infinitum. But how do you actually _justify_ that claim?

"It doesn't matter in practice." is not a valid response! Why do think 
it doesn't matter in practice? "That's my personal experience." is not a 
valid response either. The claim suggests to be valid for a much broader 
scale than just your personal experience. Why do you think your personal 
experience translates well (or should translate well) to other people?

If it's a personal, subjective choice, that's fine with me. Great! Go 
on, use what helps you most.

But I am interested in the question why you (or others) think that 
almost all software should be developed like that. This is a very strong 
  claim, and definitely deserves more justification than "well, I guess 
that's better".

I have chosen to illustrate examples in which a dynamic approach might 
be considerably better. I am decidedly not trying to downplay static 
typing. It can be a rational choice to use a statically typed language 
in specific cases. But the claim that static typing is almost always the 
better choice is irrational if it is not based on empirical evidence.

Again, to make this absolutely clear, it is my personal experience that 
dynamic type checking is in many situations superior to static type 
checking. But I don't ask anyone to unconditionally use dynamically 
typed languages.


Pascal





More information about the Python-list mailing list