Python from Wise Guy's Viewpoint

Matthew Danish mdanish at andrew.cmu.edu
Sat Oct 25 07:13:30 EDT 2003


On Sat, Oct 25, 2003 at 02:47:28AM +0200, Andreas Rossberg wrote:
> It is not, because Lisp hasn't been designed with types in mind. It is
> pretty much folklore that retrofitting a type system onto an arbitrary
> language will not work properly. For example, Lisp makes no distinction
> between tuples and lists, which is crucial for type inference.

Tell that to the hackers who worked on the "Python" compiler found in
CMUCL, SBCL, and some others.  It does extensive type inference for both
efficiency and correctness.  But it doesn't get in the way (except in
certain rare cases), it just (noisely) informs you what it thinks.

Tell that to the people who wrote Chapter 4 of the Common Lisp standard.
http://www.lispworks.com/reference/HyperSpec/Body/04_.htm

> If you want to have extensible overloading then static types are the only
> way I know for resolving it. Witness Haskell for example. It has a very
> powerful overloading mechanism (for which the term 'overloading' actually is
> an understatement). It could not possibly work without static typing, which
> is obvious from the fact that Haskell does not even have an untyped
> semantics.

Correction: it could not work without typing--dynamic typing does not
imply a lack of typing.  I could be wrong, but it seems you would rule
out generic functions in the CLOS (and dynamic dispatch in general) with
the above statement.

> Erasing type information from a program that uses type abstraction to
> guarantee certain post conditions will invalidate those post conditions. So
> you get a program with a different meaning. It expresses something
> different, so the types it contained obviously had some expressive power.

This doesn't sound right: erasing type information should not invalidate
the post conditions; it should simply make it more difficult
(impossible?) to check the validity of the post conditions.

This program should still work, even if you fail to type-check it, if
said type-checking would have passed successfully.

> Erasing type information from a program that uses overloading simply makes
> it ambiguous, i.e. takes away any meaning at all. So the types definitely
> expressed something relevant.

This statement is irrelevant because dynamic typing does not eliminate
type information.

-- 
; Matthew Danish <mdanish at andrew.cmu.edu>
; OpenPGP public key: C24B6010 on keyring.debian.org
; Signed or encrypted mail welcome.
; "There is no dark side of the moon really; matter of fact, it's all dark."




More information about the Python-list mailing list