On Aug 23, 2005, at 17:09, Kevin Tew wrote:
Problem:
Python PMC's just don't work in the leo-cxt5 branch which will become
head/trunk at some time in the hopefully not to distant future.
Err, I hope to merge RSN ;-)
I had a conversation a long time ago with Dan, in which he agreed that
given Python's property bag style object system. That class methods
and
data members should be stored in parrot properties and the vtable
getattribute/setattribute methods for python pmcs should be overridden
to
use parrot properties instead parrot attributes.
This isn't quite right - or only partially I think. The main problem
with properties is: props dont' inherit. It of course depends a lot on
the Pyton -> PIR translator. But I think the following strategy should
work:
- use parrot object system with a PyClass base class
- make the compiler smarter about attribute access, it can create a
list of attribute names
- let these "static" attributes be handled by the parrot code
- provide an additional hash slot (__dict__) as another internal
attribute for "dynamic" attributes and per object attributes
- Python __slots__ translates to the arrayish Parrot layout w/o changes
probably
- you have to check for __xxx__ attributes anyway to get e.g.
overloading or other special attribute handling done correctly.
Comments welcome.
Kevin Tew
leo