[Types-sig] Re: [Python-Dev] Revive the types sig?

Paul Prescod paulp@ActiveState.com
Mon, 12 Mar 2001 17:55:33 -0800

"Barry A. Warsaw" wrote:
> ...
> First, it seemed to me that the greatest push for static type
> annotations at IPC9 was from the folks implementing Python on top of
> frameworks other than C.  I know from my own experiences that there is
> the allure of improved performance, e.g. JPython, given type hints
> available to the compiler.  While perhaps a laudable goal, this
> doesn't seem to be a stated top priority of Paul's.

My impression is that alot of people were interested in ERR and DOC. I
don't recall much discussion of OPT at all. Everyone was just enthusing
about the benefits of explicit interfaces and type checks.

> Second, if type annotations are to be seriously considered for
> inclusion in Python, I think we as a community need considerable
> experience with a working implementation.  Yes, we need PEPs and specs
> and such, but we need something real and complete that we can play
> with, /without/ having to commit to its acceptance in mainstream
> Python.  Therefore, I think it'll be very important for type
> annotation proponents to figure out a way to allow people to see and
> play with an implementation in an experimental way.

100% agreed!

> ...
> The key trick is that it all hooks together with an import hook so
> normal Python code doesn't need to know anything about the mechanics
> of PTL compilation.  Given a homepage.ptl file, they just do an
> "import homepage" and this gets magically transformed into a .ptlc
> file and normal Python objects.

We discussed something like this at IPC9 for implementing various
experimental compiler frameworks. Unfortunately I had forgotten that
compiler.py depends on Python's compiler under the hood. :(

> If I've got this correct, it seems like it would be a powerful tool
> for playing with alternative Python syntaxes.  Ideally, the same
> technique would allow the types-sig folks to create a working
> implementation that would require only the installation of an import
> hook.  This would let them build their systems with type annotation
> and prove to the skeptical among us of their overwhelming benefit.

I absolutely agree. We just need a technologically reasonable way to
attack the problem. One way is to hide the types stuff in strings or
comments. (yuck) Another way is to embed it in standard Python syntax.
(yuck) A third way is to develop an experimental compiler (based on what
resources?). Suggestions are welcome...

    Programming the way
    indented it.
       - (originated with Skip Montanaro?)