Python from Wise Guy's Viewpoint
Matthias Blume
find at my.address.elsewhere
Mon Oct 27 15:38:24 EST 2003
Pascal Costanza <costanza at web.de> writes:
> Andreas Rossberg wrote:
>
> > Pascal Costanza wrote:
> >
> >>
> >> Can you show me an example of a program that does't make sense
> >> anymore when you strip off the static type information?
>
> > Here is a very trivial example, in SML:
>
> > 20 * 30
>
> > Multiplication, as well as literals, are overloaded. Depending on
> > whether you type this expression as Int8.int (8-bit integers) or
> > IntInf.int (infinite precision integer) the result is either 600 or
> > an overflow exception.
>
> > So the program does not make sense without type information, because
> > it does not have an unambiguous (i.e. no) semantics.
>
> > I'm ready to admit that it may be a dubious example of a typing
> > feature. But it is simple, and clearly sufficient to disprove your
> > repeated claim that static types don't add expressiveness to a
> > language. If you did not have them for the example above, you needed
> > some other feature to express the disambiguation.
>
>
> Sorry, do you really want to say that I can't make my program throw an
> exception when some variables are not inside a specified range?
No. Where did you get that from.
His point was that without the type information you don't know whether
the above "program" should be transliterated into this:
> (assert (typep (* 20 30) '(integer 0 255)))
or simply this:
(* 20 30)
Matthias
More information about the Python-list
mailing list