[Types-sig] Shadow File Opinions?

Paul Prescod paul@prescod.net
Tue, 14 Dec 1999 12:45:28 -0800


Martijn Faassen wrote:
> 
> ...
> While my agenda is to kill the syntax discussions for the moment, I'd
> propose a seperate declaration syntax before all others, because this is
> the most syntactically compatible with Python. And easier on the
> programmer.

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?

> Imagine you have a module. Now you want to make it fully statically
> typed. With most syntax proposals I've seen you'd have to go through the
> code and add type declarations here and there, mix it with the current
> code.

I think that any proposal that requires you to keep two separate files
"in sync" is bound to fail in the long term. I left that crap behind in
C++. But in the short term...okay.

> With either a Python based system as I'm proposing (ugly but powerful
> and fairly simple), or a seperate type declaration system, you have your
> type declarations separated from the code itself. This means you easily
> add and remove type information and switch between a statically typed
> module and a dynamically typed module easily.

But there is not going to be alot of "switching". You add declarations
and you leave them there. You update them when they get out of sync with
the code. Why would you want to take a nice, safe, optimized module that
you have gone to the effort of type annotating and hide the annotations?
-- 
 Paul Prescod  - ISOGEN Consulting Engineer speaking for himself
Three things to be wary of: A new kid in his prime
A man who knows the answers, and code that runs first time
http://www.geezjan.org/humor/computers/threes.html