[Types-sig] Shadow File Opinions?

Bill Janssen janssen@parc.xerox.com
Tue, 14 Dec 1999 19:27:14 PST


> I'm considering your argument carefully. If we make separate interface
> files then we get Python 1.5 (hell, Python 1.0) compatibility "for free"
> and we can experiment with different syntaxes without breaking Python
> code. Plus we could use IDL and type libraries for type analysis
> *already*.
> 
> I think the final product must allow inline declarations but I am
> starting to think that in the short term, "interface definition" files
> are the way to go not just for builtin modules but for all modules.
> 
> Do others agree?

Hey, I agreed with this five years ago!  The tricky part is
type-checking your use of that module without type declarations in the
usage-side code.

But yes, the standard process is:

1)  Add separate interface files, containing declarations of the
interface exported from a module file.  This is documentation even if
used for no other purpose.

2)  Add a type inferencer that checks code using a module against the
interface for that module.  Provided you don't kill yourself writing
the type inferencer (which almost happened here attempting the type
inferencing system for SchemeXerox :-), you can now make some limited
type checking available.

3) Move the type declaration syntax you developed for step 1 into the
language proper.  The parser is initially rigged to ignore it (and
maybe it always will).

4)  Now the type inferencer/checker is re-written to take advantage of
the real type annotations in the usage-side code.

5)  (Optional) Do away with the separate interfaces developed in step
1 and move the type declarations into the implementation of the
module.

Bill