[Python-3000] Type Comparisons with Godel Numbers
skip at pobox.com
skip at pobox.com
Sat Apr 22 05:40:17 CEST 2006
Giovanni> One way would be to keep boolean flags like "is this a list of
Giovanni> integers". It could be updated after each list modification,
Giovanni> so that typechecks come for (almost) free.
Where would that be done? If it's in the untyped function in Guido's
example, how does it know it's supposed to be a list of ints? If it's in
the typed function the untyped function calls, it seems to me you'll have to
do the entire check of a million elements before any user code is executed
to raising a typecheck error after partial execution someone else brought
up.
Other (difficult or unworkable I think) alternatives:
* Require that typed functions may only be called by other typed functions.
That way lies madness I think. It seems to me like it would be similar to
the "const" virus in ANSI C.
* Allow lazy type checking, but implement some sort of transaction that is
only committed if the typed function executes successfully. (More
madness. I know! Implement the virtual machine objects in a database!
Tell the Jython and IronPython folks to suck rocks!)
Then again, perhaps brighter folk will think of something that will actually
work. (I'm happy to live without type annotations, but that's just me.)
Skip
More information about the Python-3000
mailing list