[Types-sig] Back to basics

Paul Prescod paul@prescod.net
Wed, 22 Dec 1999 15:56:44 -0600


I think that our version 1 is going to spin out of control if we spend
too much energy trying to reverse engineer what Python code means in
terms of a type system. Yes, I think that we can easily extract type
declarations from 90% of all Python code. We will do that for version 2.
Yes, I think that there are more sophisticated ways of doing data flow
analysis, we may do that for version 3.

For version *1* we should going to require all declarations to be 100%
explicit. We will allow out-of-line declarations in "shadow files" to
allow the annotation of "old" Python and C modules. Inline declarations
will be treated as Tim Peters suggests. They are identical in semantics
to out-of-line declarations. Inline declarations should always be
preceded by the "decl" keyword so that they can be easily stripped.

We can even write a small script that extracts them from Python code and
generates an out-of-line file so that the semantics are clearly not
context-dependent. In version 1 there is no automatic anything.

There will be two syntaxes for declaring types: interface declarations
and compound typedecls. Both are parameterizable.

This should help us to answer (in the short term) many of the tricky
questions that have been raised. "del foo" is merely illegal if it
violates the declared interface of a module and is not otherwise. 

a=5
a='abc'

is illegal if it violates the declared interface of a module and is not
otherwise.

In version 2 and subsequent versions we can get to automatic type
detection and maybe dataflow and type inferencing. But for version 1
we've got to KISS if we're going to make progress.

 Paul Prescod