On Tue, May 21, 2002 at 03:57:33PM -0500, David M. Lloyd wrote: > Are the REGEX structure and the match vtable methods officially dead? The > POD inside of rx.ops does not mention them at all, and right now REGEX is > typedef'd to void and no-one uses the 'match' method for anything. > > Since regular expressions will most likely be implemented as Parrot > bytecode, would it not make more sense to make a regular expressions be a > PMC class, something like "PerlRegex"? > > The PerlRegex class could have a compile method that would (ultimately, > anyway) compile a string down to an opaque object. Then there would be a > match method that would be somewhat opposite of the match method we > (don't?) know today, in that the argument would be the PMC you are trying > to match and the PerlRegex object would do the bulk of the work, perhaps > calling methods on the argument PMC to get incremental units of work or > something like that. > > Make sense?
I implemented it that way once in my private tree. But I ended up replacing it with a couple of PerlArrays. I am now of the opinion that there's currently nothing for a regex PMC to do. At compile-time, you know what sort of beast you're matching against. If you want to incrementally match an input sequence of some sort, then you should probably be using the same continuation or coroutine mechanism that regular subs use. Of course, a regex PMC would make a lot more sense if the regex engine were not done as bytecode, and instead done perl5-style. And Mark Kvale has some pretty good performance numbers arguing that direction.