[pypy-dev] question about core implementation language
arigo at tunes.org
Mon Jan 20 11:41:01 CET 2003
On Sun, Jan 19, 2003 at 06:23:03PM -0500, logistix wrote:
> I think the point is that Python as a language provides absolutely no
> access to the machine internals. You can't examine memory contents,
> registers, I/O bus or call code directly.
It doesn't matter. It has to be built on the top of *some* basic
abstractions, but these don't have to be as low-level as that. The
interpreter proper can be written in pure Python, and only specific
"non-borrowing" implementations need more (e.g. to implement a list as an
array of PyObject* with a length field, or to implement the time.time()
function by calling a Posix- or Windows-specific OS function).
Ideally, we can provide various implementations of the same concept upon
various lower-level concepts. We should not stick to one given low-level
abstraction. We might for example give two "list" implementations, one based
on "memory block" objects that correspond closely to malloc()ed blocks, and
one as a Lisp-like chained list based on couples (2-tuples).
In all implementations we should somehow express what other abstractions this
implementation depends on. The final code emitters can then choose which
implementation(s) they will use depending on what low-level abstractions are
provided by the target language (e.g. targetting C, the "memory block" objects
are ideal; for Java we might reuse its built-in concept of array).
More information about the Pypy-dev