[pypy-dev] Summer of PyPy pre-proposal

Armin Rigo arigo at tunes.org
Mon Aug 14 13:38:06 CEST 2006


Hi Lenard,

On Sat, Aug 12, 2006 at 11:54:42AM -0700, Lenard Lindstrom wrote:
> I must be missing something here. Isn't Python's object model defined 
> by the type objects themselves?

I was thinking about the way all objects work; the type objects only
define methods and properties of their instances, but not *what* a
method or a property is.  In Python, the "object model" contains a lot
of logic about what special method calls are triggered by "a+b", and how
an attribute lookup is performed.  In JavaScript the object model is far
simpler: it is described by a number of internal properties that objects
have, like [[Prototype]], and how these properties are used in various
operations like attribute lookup.

It needs to be done, but that's not necessarily difficult indeed.  It's
possible that other aspects will be more irksome.  Nevertheless, it
means that you can never really reuse the bytecode of one dynamic
language to implement another one, because the "object models" are
typically quite different, in the sense above.  Most bytecodes -
GETATTR, BINARY_ADD, etc. - do things in Python that are completely
unrelated to what the equivalent bytecode would need to do in
JavaScript, even before we consider type objects.


A bientot,

Armin



More information about the Pypy-dev mailing list