Edward Peschko writes:
> > > If you need to match the regex engine in reverse, in a totally unattached way 
> > > via subroutine, then I would think the chance for subtle mistakes and errors 
> > > would be exceedingly great.
> > 
> > I don't understand how.
> 
> it means that you have to reimplement - in reverse - the logic of the
> regular expression engine in a separate place.  I'd like to tie the
> testing of the regular expression engine to the generate engine - the
> closer the tie the better.  In 'make test' if necessary).  

How do you do that?  Generation and matching are two different things
algorithmically.

If you wanted to keep it centralized, you could generate all strings and
see which ones match...  or... not.

> 
> That way, any change to the regular expression engine is guaranteed to be
> added into both places:
> 
> @gen = g:bnd(1000)/<[ab]>+/
> if (@gen !~ m/<[ab]>+/) { print STDERR "something is seriously wrong..\n"; }
> 
> or maybe even
> 
> (g:bnd(1000)/<[a-b]>+/ !~ m/<[a-b]+>/) && print STDERR "SOMETHING IS SERIOUSLY 
> WRONG"\n;
> 
> I suppose generate could be distributed in a standard module

Or even a nonstandard module.  That's my point.

Let me come right round to my point about perl being open source.
Someone has to do the work somewhere, and making it "standard" or "core"
doesn't change that.  It just means that it'll take longer.

This functionality, while useful, is most fit for a module.

> > I'll show you.  Here are some of the generators.  This is very dense,
> > functional code.  Read at your own risk (but I'm certainly not writing
> > it to be executed!).
> 
> yes, i see this is cool. I'd just hope that there would be an equivalent set of 
> rules that matches the entire regular expression engine, and distributed with
> the 'standard' perl6 distribution if there is such a thing.. And that there isn't
> too much of a performance hit in the case of extreme recursion.

Making "standard" also doesn't make it any faster.  You have to burn the
cycles somewhere along the line in any case.  The algorithm is
recursive, and that's a mathematical truth.  If you can find a
nonrecursive algorithm, please do so, and then you can put it in a
module.

I think we should all settle on the fact that any feature could be
considered "standard", but very few probably should.  And what is is
Larry's decision, and I think we should leave it at that.

Luke

Reply via email to