[pypy-dev] Does RPython have slice?
arigo at tunes.org
Fri Oct 24 13:54:43 CEST 2003
On Fri, Oct 24, 2003 at 12:05:54PM +0900, Seo Sanghyeon wrote:
> Does RPython have slice?
I am not too familiar with std/stringobject.py, I can't say how this code
should be translated or if it shouldn't have used slices in the first place.
In general I think that slicing from a list can be regarded as the operation
of malloc()ating a new, smaller list and memcpy()ing data around, which is
fine as long as you are aware of this.
Depending on the code generators, it may be useful as you suggest to have
general graph transformations that change unsupported constructs into
reasonably efficient lower-level supported ones. I can imagine that (using
type inference) we could change newslice/getitem pairs into, say, malloc
followed by an explicit loop of getitem/setitem.
BTW (in case you're not already aware of this) the Lisp generator will have to
be fixed at some point, because it cannot simply translate "add" into "+".
This only works if type inference says the arguments are integers.
More information about the Pypy-dev