I was uneasy when the C<num_eq> and C<str_eq> vtable entries were first
proposed.  Sure, they get the job done for Perl 5, but Perl 6 is
expanding its notion of context beyond those compiled in.  You're
supposed to be able to add, say, "nontransitive ring" context if you
want.

There needs to be a way to pass context into not only sub calls, but
vtable methods, and maybe even certain non-vtable ops.  Rather than add
an extra op parameter for each of these, I propose we make it stateful,
like:

    num_eq $P0, $P1, foo
    str_eq $P0, $P1, bar

Becomes

    context .NUMERIC
    eq $P0, $P1, foo
    context .STRING
    eq $P0, $P1, bar

This works efficiently since context often propigates inward, as in:

    if   $x + $y > $z  {...}
         -------
           num
         ------------
            num
       ---------------
            bool

And that, like classes, contexts would be specified by integer
descriptor, or at worst, constant PMC.

This might also be modified to fit in nicely with the proposed "key
registers" idea.

Luke

Reply via email to