[pypy-dev] Confused about RPython

Christian Tismer tismer at stackless.com
Fri Jul 29 13:29:34 CEST 2005

Hi Niklaus,

> I am currently seriously confused about the notion of RPython, and I 
> hope someone can show me the light here. ;)

blink blink :)

> I guess my basic problem is: How do I find out if some code is RPython? 
> And especially in the context of the array module im currently working 
> on, how do I find out if a module is RPython?

I see you want to write the array module at interplevel.
This makes sense, applevel has problems here. interplevel
with possibly give you problems as well, I guess, because
I have no clue how to express the buffer interface for instance.
We don't have pointers and too few basic types.
If you stubleofver such problems, please don't hesitate to
contact the list.

> One of my working hypothesis was that whatever can be geninterped is 
> RPython. But by that definition, a *lot* more comes out as RPython than 
> the documentation says. Is it just that the documentation is out-of-date 
> or is geninterping not a good criterion? E.g., when Christian states 
> that _codecs is now RPython, does that just mean it can be geninterped 
> or is there something else to it?

Well, I think my notation is a biut confusing, of course.
Should have tagged nn-geninterpable code differently.
The tag "NOT_RPYTHON" is used inside PyPyto signal stuff that
we should not try to translate, the annotator will raise an exception
if it sees such a thing, and so on.
So I used the same tag to signal that "This applevel code is not
suitable for geninterp". Of course, this is some kind of "applevel
RPython" in the sense that it can be pured through geninterp
to create an RPython interplevel module.

And this is all what it is saying. If you are writing on interp level,
geninterp doesn't help. You need to translate to some target and see
whether flowspace and rtyper are happy with it.

> Armin just had a checkin where he replaced str.isalpha() with something 
> else because string methods are not RPython. But I can geninterp and 
> even C compile string methods just fine. Did he use the term "RPython" 
> loosely, meaning something like "what can be usefully annotated" (ie, 
> string methods always result in SomeObject, that's probably why they're 
> frowned upon in the interpreter code)?

I used it loosely, in a sense. Maybe I should rename the tag.

cheers - chris

Christian Tismer             :^)   <mailto:tismer at stackless.com>
tismerysoft GmbH             :     Have a break! Take a ride on Python's
Johannes-Niemeyer-Weg 9A     :    *Starship* http://starship.python.net/
14109 Berlin                 :     PGP key -> http://wwwkeys.pgp.net/
work +49 30 802 86 56  mobile +49 173 24 18 776  fax +49 30 80 90 57 05
PGP 0x57F3BF04       9064 F4E1 D754 C2FF 1619  305B C09C 5A3B 57F3 BF04
      whom do you want to sponsor today?   http://www.stackless.com/

More information about the Pypy-dev mailing list