On Aug 23, 2005, at 18:21, Sam Ruby wrote:


Kevin Tew wrote:

  We don't have to pass self around, parrot
makes it available to us automatically.

I added self on Leo's request.  Now it is unneccessary.  *shrug*

Parrot's new calling conventions are passing 'self' as the first argument of a method. Therefore all the old workarounds like:

  METHOD PMC* __abs__(Interp* interp, PMC* SELF, PMC* self) {}

aren't needed any more.

Sam's PMC's were also incomplete, they lacked support for a lot of the
__add__ style python methods.  This is quite understandable, Sam was
trying to get something working.

Check out parrot/t/dynclass/pyint_2.pmc.  __add__ style methods were
working, and tested.

PMC* "__add__"(PMC *self, PMC *value)

Please note that this signature includes like above already the interpreter and, SELF i.e. the invocant PMC. This is for sure not correct. The implementation is in pyobject.pmc and redispatches via MMD to the actual multi sub.

So yes, the pyint.t test worked - overloading didn't.

No matter what you do, Leo will tell you that the whole approach is
wrong.  I talked this past weekend with Larry Wall, Chip Saltzberg, and
chromatic.  Hopefully we will get some more people involved.  Leo is
great at details, but has a tendency to set a new direction every week.
 I say that knowing that Leo follows this list. (Hi Leo!)

One year ago we had some discussion, where e.g. we both stated that the object should be passed as first argument to methods. Now it's eventually done in my branch.

I do agree with test-driven development. That is exactly the approach I
took.

Well, I agree - until I see such tests (pyint_1):

    $P2 = $P1.__abs__($P1)

- Sam Ruby

leo

Reply via email to