On Fri, Dec 10, 2004 at 01:34:03PM -0500, James deBoer wrote:
> Currently, the split opcode is declared as 'split(out PMC, in STR, in 
> STR)' where $2 is a regex.
> 
> PGE, however, currently supports three types of regular expressions, and 
> more are likely going to be added. So, which type of regular expression 
> should split use?
> [...]
> A solution:
> 
> Declare split as 'split(out PMC, in PMC, in STR)' where $2 would be a 
> compiled PGE::Match object. This lets you pick what kind of regular 
> expression you want to use.

Slight correction:  Thus far a "PGE::Match object" is the result of 
performing a match between a rule and target string, not the compiled 
form of the rule.  At present a rule is just a subroutine that returns
PGE::Match objects.  Eventually we may have a PGE::Rule class for
representing compiled rule objects, but we're not there yet.  So, $2 
would need to be a rule subroutine.

Going beyond that, we might want to just have a "split" method for 
PGE::Rule objects, and leave the split opcode to do fast separation
of strings based on constant strings.  But I'm not entirely familiar
with Parrot's opcode/MMD semantics so I'll follow others' leads on this
one...

Pm

Reply via email to