<moritz_> rakudo: say ('a' ~~ /a/).WHAT
<p6eval> rakudo 16efb6: OUTPUT«Regex::Match()␤»
<moritz_> rakudo: say ('a' ~~ /a/) ~~ Match
<p6eval> rakudo 16efb6: OUTPUT«Could not find non-existent sub &Match [...]
* masak submits rakudobug
The spec is pretty clear that it should be Match.
#Tue, 09 Mar 2010 05:16:08 -0800The RT System itself - Tag Bug added
This has been discussed on IRC, but for the record I'll dump my thoughts
and current progress here.
First the matter is much deeper than simply a wrong type name: All of
the objects accessible form the current Match object are really parrot
types, so for example .kv won't work on the hashes, .sort will call
parrot's built-in sort, and not the Perl 6 (much more magical) sort etc.
The correct solution seems to be to let NQP-RX build Perl 6 match
objects, not NQP/parrot match objects.
To achieve that more easily, I created the 'refactor_mob_generation'
branch of NQP-rx. It aims at detangling the match object generation
logic from the actually process of creating/instantiating the match
object. In this branch, NQP-rx has the type object of a Match class, and
calls the .create method on it, along with various arguments (original
string, position, match length, named and positional captures) and lets
the type object take care of the actual instantiation.
This has the advantage of better encapsulation, but the disadvantage of
creating more objects: instead of writing directly to the Match object,
now arrays and hashes are created first, which in turn are then copied
onto the Match object.
So there are basically three things left do:
1) wait for Patrick to review the branch, and if he's agreeable, merge it
2) Implement a means to pass a different type object to NQP-rx
3) Implement a pure Perl 6 Match object, and hook it into NQP-rx
Once done, this will fix both this ticket and probably RT #70003.
#Sun, 04 Apr 2010 08:49:46 -0700The RT System itself - Status changed from 'new' to 'open'
It sounds like this bug is going to address what I care about, but let me
add a test case, just for clarity:
ajs: rakudo: "abc" ~~ /[ 'a' $<b> = (b) ]?/; $/<b>.WHAT;
p6eval: rakudo c5fdb1: OUTPUT«Method 'WHAT' not found for invocant of
class 'ResizablePMCArray'␤current instr.: '_block14' pc 29 (EVAL_1:0)␤»