Test cases and static typing

Dirk Thierbach dthierbach at gmx.de
Sat Oct 25 02:09:51 CEST 2003


Pascal Costanza <costanza at web.de> wrote:

> A flexible and useful IDE must treat static type checking as a separate 
> tool. It needs to be able to do useful things with code that isn't 
> correct yet. 

I don't agree with the "must", but type checking is a seperate phase
in the compiler. It should be possible to make an IDE that treats
it that way. But I doubt that particular point is high on the priority
list of any potential programmer of an IDE. 

> And that's all I wanted from the very beginning - static typing as an 
> additional tool, not as one that I don't have any other choice than use 
> by default.

And that's fine, but it is not an issue of static typing.

>>>>>The type system might test too many cases.

> No, it's not better to give an example in a different language. The 
> whole point of my argument is that the code above cannot be statically 
> type-checked. 

You can look now at two examples of code like this that can be
statically type-checked. 

And I had the impression that you wanted to explain why a "type system
might test too many cases". I still don't understand this argument. I
don't see any "case" that the type system will test in the above
program, let alone "too many".

>> I could probably rewrite the code with an approximation to cerror
>> (with the restriction that non-local control structures don't 
>> translate one to one), but even then I don't see why the type system
>> would test too many cases for this example.

> I don't want an "approximation of cerror". I want cerror!

Then use Lisp and cerror. Nobody forces you to use anything else. The
problem is again that you want to do it only in exactly the same way
as you are used to doing it. You don't see how to do it in another
language, and then you say "it cannot be done". And that's just wrong.

So can we settle on "you like to do it your way, but it is possible
to do everything you want in a statically typed language if
you're a little bit more flexible"? (That means of course that if
you refuse to be a bit more flexible, it cannot be done in exactly
the same way -- after all, they are different languages.)

As long as you say "this cannot be done" you'll get answers showing
you that it can indeed be done, only in a way that is a little bit
different. Then you say "yes, but that's not how I want it. You're
trying to force to use me something I don't want!".

It gets a bit silly after some iterations. Let's stop it.

- Dirk




More information about the Python-list mailing list