Sam Ruby wrote:
Leopold Toetsch wrote:

A "foo" PMC could represent an entire row in a two dimensional MMD, or an entire plane in a three dimensional MMD, ... etc.

What does it mean: "represent a row..."? What about the namespace pollution? Again: where does this hypothetical MMD PMC come from?


A Perl6 compiler could translate the above to:

    87 find_lex P5, "a"
    90 find_lex P6, "b"
    93 find_lex P7, "c"
    96 find_global P0, "foo"
   108 set I0, 1
   111 set I1, 0
   114 set I2, 0
   117 set I3, 3
   120 set I4, 0
   126 invokecc

You seem to like double dispatching :-)

The "foo" PMC could know how many of the arguments are relevant for MMD dispatch. Should only the first two arguments be relevant, this code could be as simple as:

void* invoke(void* next) {
...
if (cache->type == (Py->vtable->base_type << 16|Pz->vtable->base_type)
return VTABLE_invoke( cache->function );
...
}

Where ist the C<cache> coming from? Please read again my articles WRT *inline* cache.


Where does this hypothetical MMD PMC come from? Where is it created? The opcode is just:

  add Px, Py, Pz

Py or Pz can be plain PyInts or Integers. Where does that MMD PMC come from?


Once MMD is solved connecting it up to the PerlScalar PMC (for example) would be rather straightforward. Syntax like the following would result in an appropriate entry being added to the MMD dispatch table:

How do you "connect" MMD to the scalar PMC? And to which scalar PMC? Which MMD dispatch table?


  multi sub infix:+ (Us $us, Us $ustoo) {...}

The Parrot_PerlScalar_add function (which would revert back to being a vanilla vtable) would know about the portion of the MMD dispatch table that is relevant to Perl scalar add operations, and invoke it.

So Perl is unable to add an integer that originated from Python code. Sam that all doesn't play together.


(Note: one thing that hasn't been discussed to date is how registers will be handled. The current add opcode doesn't have any side effects)

That's obvious: overloaded operations don't have side effects WRT register usage, and the current implementation in Parrot core preserves all registers.


- Sam Ruby

leo



Reply via email to