Christian Tismer wrote:
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.
I am actually trying to write it in applevel, making sure it can be
geninterped. If I can do this in a resonable amount of time I might try
to rewrite some stuff on interplevel. You can see the current effort
here, BTW:
http://codespeak.net/svn/user/nik/array_py/trunk/src/array.py
I think the buffer interface is a no-brainer, but maybe I'm missing
something. Our buffer type is written at applevel, we have no obligation
at all to emulate CPython's C-based buffer interface. We can define our
own interface, and in fact the current buffer implementation sort of
does that. Hacking array support into the current buffer will be a
matter of 2-3 lines of code, AFAICT. More effort would be a waste of
time anyway, as buffer is as good as deprecated. ;)
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.
I see, that really clears things up a bit. Is it correct to say that
geninterping such an "applevel RPython" module guarantees that the
resulting interplevel code can in fact be translated? That sounds a bit
too much like magic to me.
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.
OK. Just to be a bit more explicit about this, I do something like:
>>> t = Translator(my_rpython_function)
>>> t.annotate([int])
And check that the inferred return type is not SomeObject. This
basically means that flowspace and rtyper are happy, right? What I don't
understand ATM is where the translator will get the above "[int]"
annotation hint from in the real world ...
Thanks for showing me the light so far. ;)
Cheers
Nik
_______________________________________________
[email protected]
http://codespeak.net/mailman/listinfo/pypy-dev