[pypy-dev] pirate list

Michal Wallace michal at sabren.com
Wed Jul 13 03:58:34 CEST 2005

On Tue, 12 Jul 2005, Armin Rigo wrote:

> On Sun, Jun 12, 2005 at 11:15:30PM -0400, Michal Wallace wrote:
>> Pirate is written in python and currently
>> uses the standard compiler package. However,
>> as parrot supports native types, I would like
>> to refactor it so that it can also work with
>> PyPy's type annotation system (and possibly
>> integrate with pypy in other ways)

> Interesting, though by no means easy :-) PyPy's type annotation
> system is not designed at the moment to handle random user code.  It
> can only handle carefully controlled code.  From there to a general
> type annotator for Python, the gap is still large.

Hi Armin,

Thanks for clarifying. Sounds like my understanding of
pypy's current state was completely backwards.

There is another approach I've been considering
for pirate, which might come in handy for pypy 
as well: explicitly stating type information in
a separate file, along the lines of this type
system for scheme:


Basically, you'd have a separate "typesheet" file
which said stuff like:

    # add.ty
    def add(a=int, b=int):
        return int

which would correspond to the python code:

    # add.py
    def add(a, b):
        return a + b

It seems like this would be a very simple way to get 
type annotation working: we'd just do it by hand. Then 
once we have real type inference, we could toss it aside.

My intuition is that this would be fairly easy for me
to add to pypy, but I'm not familiar with the code yet.
What do you think? If possible, I'd rather extend your
compiler than using the standard compiler module (which
is what pirate currently uses)

> I may be too deeply buried in the current development work, but at the
> moment it seems to me that the immediate contribution that PyPy could
> make to Python-over-Parrot could be different: we could provide the
> built-in types implementation and standard library modules, which is the
> necessary complement to the bytecode compiler.  Indeed, by tweaking the
> C code generator, the "standard object space" and the modules could be
> compiled from PyPy sources to some C code that follows the conventions
> of Parrot.

This is the other part I was backwards on.

Just to be clear, and to share this idea with the pirate list,
you're saying that all the built-in python types, which you guys
have rewritten in your "restricted" python, could be compiled
to produce parrot PMCs? Or in other words, that we could write
our PMCs in rPython?


If I can spend my time hacking on pypy and reap the benefits
for pirate, sign me up. I'd rather do that than write PMC's

What's the plan for modules like socket, that basically
wrap external C routines? Is that in the works for pypy
as well? It almost seems like they'd require some 
extensions to python syntax (sort of like pyrex).


Michal J Wallace
Sabren Enterprises, Inc.
contact: michal at sabren.com
hosting: http://www.cornerhost.com/
my site: http://www.withoutane.com/

More information about the Pypy-dev mailing list