[pypy-dev] AbstractObjectSpace

Günter Jantzen guenter.jantzen at netcologne.de
Sun Jun 15 07:19:19 CEST 2003


Hello,

on
http://codespeak.net/moin/pypy/moin.cgi/AbstractObjectSpace

I found:
"
Typically, however, abstract object spaces are a (little) bit less abstract,
still maintaining a minimal amount of information about the objects. For
example, a wrapped object could be represented by its type. You then define
the object space's add to return int when the two arguments are int and int.
That way, you abstractedly call a function with the input argument's types
and what the interpreter will do is a type inference. (Here also there are
subtle problems, even besides the remark that integer operations can
overflow and actually return longs in a real Python implementation.)
"
This concept will only work when output types can be determined by input
types (independent of concrete values).
This will be a language restriction. For example, the following function
will not be valid in restricted Python:

def spamrelease(i):
   if i > 0:
      return i - 1
   else
      return "counter is closed"

Consequently we should work with function prototypes. Not as restrictive as
in C. More a set of rules or patterns
for calculating output types from input types.

Günter




More information about the Pypy-dev mailing list