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.

Cheers,
Moritz

Reply via email to