> 5) new opcodes that return a new result:
> Px = n_add Py, Pz # new Px created
> These opcodes will be done RSN.
RSN is now. There is one basic test in t/pmc/integer.t. Overloading
is tested in mmd.t.
More tests are welcome for other PMCs.
Caveat: the "n_" variants for the infix opcodes work only for the
arithmetic operations: add, sub, mul, div, fdiv, mod, cmod, pow.
leo
> TODO items and design issues
And some more:
6) stringish MMD infix operators: concatenate, repeat
The implementation takes either two strings, or one string and an integer
repeat count. Again not much multi to dispatch IMHO.
Missing: PMC variants of substr, index, split, join, and tons more.
This should all be builtin (NCI) methods of the String PMC.
leo
> TODO items and design issues
>
> 1) bitwise or, and, xor
>
> We currently have two distinct sets of opcodes and MMD functions for
> numeric (i.e. integer) and string bitwise functionality. E.g.
>
> bor Px, Py # $x +|= $y
> bors Px, Py, Pz # $x = $y ~| $z
>
> It now depends on the Perl6 code generator how the Parrot
> implementation should behave (or vice versa :)
>
> a) just do MMD
>
> Px = Px.__as_number() # numeric context
> $P1 = Py.__as_number()
> bor Px, $P1 # MM dispatch on <Int, Int>
>
> $P0 = Py.__as_string() # string context
> $P1 = Pz.__as_string()
> bor Px, $P0, $P1 # MM dispatch on <Str, Str>
>
> b) use current distinct opcodes
>
> bor Px, Py # call get_integer() internally
>
> bors Px, Py, Pz # call get_string() internally
>
> If a) is true, we would have just one set of bitwise MMD functions.
> If b) is true, then there is no MMD needed as the functionality is
> always the same: make numeric/string and do the bitwise operation.
> This would be better implemented with a vtable method.
This all got Warnocked, didn't it?
Having read it twice, I don't think I'm going to get closer to a decent
response than "er, this is really a call for the designer to make, isn't it?"
Nicholas Clark
> This all got Warnocked, didn't it?
>
> Having read it twice, I don't think I'm going to get closer to a decent
> response than "er, this is really a call for the designer to make, isn't it?"
Mway be it's time to start a WARNOCKED file in parrot's root dir and
collect such undesigned items.
> Nicholas Clark
leo
I added a link to this one there.
Regards.