Python from Wise Guy's Viewpoint

Andreas Rossberg rossberg at ps.uni-sb.de
Fri Oct 24 11:30:31 EDT 2003


Pascal Costanza wrote:
> 
> "less expressive power" means that there exist programs that work but 
> that cannot be statically typechecked. These programs objectively exist. 
> By definition, I cannot express them in a statically typed language.
> 
> On the other hand, you can clearly write programs in a dynamically typed 
> language that can still be statically checked if one wants to do that. 
> So the set of programs that can be expressed with a dynamically typed 
> language is objectively larger than the set of programs that can be 
> expressed with a statically typed language.

Well, "can be expressed" is a very vague concept, as you noted yourself. 
   To rationalize the discussion on expressiveness, there is a nice 
paper by Felleisen, "On the Expressive Power of Programming Languages" 
which makes this terminology precise.

Anyway, you are right of course that any type system will take away some 
expressive power (particularly the power to express bogus programs :-) 
but also some sane ones, which is a debatable trade-off).

But you completely ignore the fact that it also adds expressive power at 
another end! For one thing, by allowing you to encode certain invariants 
in the types that you cannot express in another way. Furthermore, by 
giving more knowledge to the compiler and hence allow the language to 
automatize certain tedious things. Overloading is one obvious example 
that increases expressive power in certain ways and crucially relies on 
static typing.

So there is no inclusion, the "expressiveness" relation is unordered wrt 
static vs dynamic typing.

	- Andreas

-- 
Andreas Rossberg, rossberg at ps.uni-sb.de

"Computer games don't affect kids; I mean if Pac Man affected us
  as kids, we would all be running around in darkened rooms, munching
  magic pills, and listening to repetitive electronic music."
  - Kristian Wilson, Nintendo Inc.





More information about the Python-list mailing list