Typing system vs. Java

Donn Cave donn at drizzle.com
Tue Jul 31 00:33:35 EDT 2001


Quoth <brueckd at tbye.com>:
[ ... re demonstration that a type checking language can check types ...]

| But what benefit have I gained? The only reason it's an error to begin
| with is because the language is forcing me to name the type. The fact that
| the compiler can detect my breakage of the language-specific rules doesn't
| really advance the notion that strict compile-time checking is beneficial.
| What is a real world problem that would not have existed if Python had
| strict compile-time checking, and how common is such a problem? (I'm not
| saying those problems don't exist - I'm just desperate for some examples
| so I can understand the other side of the issue).

Well, one currently poignant example.  In Python, as you can hardly
fail to notice these days, division with integer inputs produces an
integer output, silently losing any fractional part.  That's held to
be a common problem.

It can happen because Python will let an integer (or anything else!)
walk into that division, and try to make the best of what happens.
If you a type checking compiler, the object would have to agree at
compile time with the programmer's notion of what would be an
appropriate input.

I don't know if that means Python should have type checking.  Its
open typed design works awfully well with OOP, and it would be a
shame to strangle that freedom for the sake of a half-baked concept
of discipline.  But some kind of type inference validation could be
applied from a lint utility - that already exists and is reportedly
useful, but I don't know if it actually covers types.  Anyway, maybe
it's an area where a big investment could yield something real
interesting for industrial strength programming.

	Donn Cave, donn at drizzle.com



More information about the Python-list mailing list