[Types-sig] Compile-time or runtime checks?

Guido van Rossum guido@CNRI.Reston.VA.US
Tue, 14 Dec 1999 22:03:17 -0500


> I'm trying hard to separate the axes of: "I have some type declarations"
> and "I want a static type checker to gurantee that this code is totally
> type safe." This should be legal:
> 
> StringType
> def foo():
> 	a=eval( sys.argv[1] )
> 	return a
> 
> That means I want a runtime check. This should be illegal:
> 
> type-safe
> StringType
> def foo():
> 	a=eval( sys.argv[1] )
> 	return a
> 
> Here I've specifically asked for a compile time check and my code is not
> up to snuff.

I would strongly advise to focus on the type-safe axis.  Run-time
checks can already be implemented using various assert statements.

--Guido van Rossum (home page: http://www.python.org/~guido/)