Kevin Tew wrote:

I've been working on a python compiler also, feel free to take a look,,
svn co http://svn.openfoundry.org/pyparrot languages/python/pyparrot

My current boggle is how to handle the self parameter to method functions.
You can do things like this in python

def foobar( arg1, arg2 ):
   print arg1, arg2

class A():
   self.__add__ = foobar

aa = A()
print aa + 5

Well, the Python translator has to recognice that "__add__" and such has a special meaning in CPython. Therefore the getattribute (in that case of the class - but not only) has to check for such special names and in that case store the Sub object for "foobar" into the "A" namespace under the name "__add" - that is Parrot's notation for the thingy.

The rest i.e. calling the sub on the last line, is done by Parrot's MMD implementation.

Kevin Tew

leo

Reply via email to