[Python-Dev] A solution to the evils of static typing and interfaces?
simon.belak at hruska.si
Fri Oct 21 04:34:02 CEST 2005
I was thinking why not have a separate file for all the proposed
optional meta-information (in particular interfaces, static types)?
Something along the lines of IDLs in CORBA (with pythonic syntax, of
curse). This way most of the benefits are retained without
"contaminating" the actual syntax (dare I be so pretentious to even hope
making both sides happy?).
For the sole purpose of illustration, let meta-files have extension .pym
and linking to source-files be name based:
With some utilities like a prototype generator (to and from meta-files)
and a synchronization tool, time penalty on development for having two
separate files could be kept within reason.
We could even go as far as introducing a syntax allowing custom
meta-information to be added.
For example something akin to decorators.
# note this are only prototypes so no semicolon or suite is needed
def playDead(a : int, b : int) -> None
name : str
where sharedinstance, cache and const are custom meta-information.
This opens up countless possibilities for third-party interpreter
enchantments and/or optimisations by providing a fully portable (as all
meta-information are optional) language extensions.
P.S. my sincerest apologies if I am reopening a can of worms here
More information about the Python-Dev