Typing system vs. Java

Alex Martelli aleaxit at yahoo.com
Thu Aug 2 13:11:38 CEST 2001


"Steve Holden" <sholden at holdenweb.com> wrote in message
news:f8Z97.12190$9i1.1016409 at e420r-atl1.usenetserver.com...
    ...
> Suppose, in your mission-critical program, you use an int to hold a value
> which should only ever be between 32 and 213. The only way you have to
> exercise that level of semantic control is to declare a class, and test
that
> no assignments violate the required constraint (unless you are using a
> Pascal derivative, which allowed that kind of thing quite nicely, or you
are

...but handles it *at runtime* in the general case, of course (even
though a few special-cases can be hoisted up to compile-time).  Not
to mention the peculiar implication of having INTEGER ranges as a
built-in language feature, and REAL ranges nowhere to be seen -- isn't
it just as important to be able to state that a REAL (in Pascal terms:
float, in Python) variable x ensures A<=x<B, as it is when x is
an INTEGER...?!

> using program proof techniques, which are of little use to the
> mathematically-deficient). So run-time value testing is required even if
you
> force the compiler to do type testing.

Yes, by far most interesting things can't be compile-time tested.


> Type safety completely fails to live up to whatever promise it might have
> unless programmers exercise adequate care to define types which do exactly
> what they want. And most programmers are somewhat sloppy about that.

And most languages (all that I know) just give programmers NO way
to make the type-assertions that really matter ("this function is
antisymmetric", and so on -- all requiring existential and/or
universal quantifiers...).


> and-i'm-no-better-than-the-rest-ly y'rs  - steve
>
> PS: Alex, I'm sorry about the "if type()..."s!

You're forgiven, Steve, as long as you undertake to sin no more...!-)


Alex






More information about the Python-list mailing list