On Jul 1, 2005, at 19:46, Michal Wallace wrote:

aa = A()
print aa + 5

Hmm. I'm pretty sure this is handled automagically by the Python pmc's in pirate... Using the + in pir (or the add op) actually invokes a dispatch

Err, *if* the python translater emits

  $Px = aa + 5

it's of course up to Parrot to call A."__add"() (it one is there). If the Python translator creates a function call for each 'add' opcode, well then performance will suck.

... I'm
not 100% sure if Sam implemented it, but if so it
would be in the pmc's, not the code generator.

I'm pretty sure that he did not implement it.


Pirate doesn't have to know anything special about
__add__ because foobar is just another pmc - one
that happens to be a callable.

Well "foobar" is a plain subroutine.

The only tricky
part I see is that because foobar doesn't have
the explicit self parameter,


Err, why should a plain subroutine have a "self" parameter?

Anyway, I *think* the existing pmc's solve all
these problems.

Why not test it?

leo

Reply via email to