Rod Adams <[EMAIL PROTECTED]> wrote:

> Leopold Toetsch wrote:

>>the method call in PIR can be written as:
>>
>>  d = x."cos"()          # normal method call
>>  d = Float."cos"(x)     # class method, argument shifted down
>>  d = P6Num."cos"(x)     # same
>>  d = cos x              # PIR opcode syntax   [1]
>>  cos d, x               # PASM opcode syntax  [1]
>>
>>There'll be a table of such builtins with name, namespace, signature, so
>>that the current opcodes can be transparently replaced by methods.
>>
>>
> This looks like it's taking

>   multi method Num::cos (Num|Str +$base) returns Num

> and generating

>   multi sub cos (Num $x, Num|Str +$base) returns Num

No. The above "lowlevel" C<cos> isn't aware of C<base> nor of C<$_> and
nothing is autogenerated in Parrot. The C<cos> is something like:

  class __parrot_core::Float {
    multi sub cos(Float x) returns Float ...
  }

This is presumably inherited by C<class P6Num> (the Parrot PMC) and
bound to:

  multi sub *cos(Num $x) returns Num

at the Perl6 level.

leo

Reply via email to