Leopold Toetsch <[EMAIL PROTECTED]> wrote:

> 5) infix method signature change:

>    METHOD PMC* add( [INTERP, SELF,] PMC* rhs, PMC ´*dest) {
>      if (!dest)
>         dest = pmc_new(INTERP, SELF->vtable->base_type);
>      ...
>      return dest;
>    }

> If the destination PMC is passed in, it's used else a new PMC of an
> appropriate type is created.

The same scheme should of course be introduced with all the unary prefix
and postfix operators:

  METHOD PMC* absolute( [INTERP, SELF,] PMC ´*dest) {
    if (PMC_IS_NULL(dest))
       dest = pmc_new(INTERP, SELF->vtable->base_type);
    VTABLE_set_integer_native(INTERP, dest, abs(PMC_int_val(SELF)));
    return dest;
  }

and

  op abs(out PMC, in PMC)
  op n_abs(out PMC, in PMC)

aka

  unary "__absolute", Px, Py
  unary "__n_absolute", Px, Py

which is the same as:

  Px = Py."__absolute"(Px)
  Px = Py."__absolute"()

leo

Reply via email to