[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: regexp and valid-sre?

This page is part of the web mail archives of SRFI 115 from before July 7th, 2015. The new archives for SRFI 115 contain all messages, not just those from before July 7th, 2015.

On Tue, Nov 26, 2013 at 10:00:10AM -0800, Michael Montague wrote:
> I don't think that these are strong arguments for having 'valid-sre?'. 
> An implementation for which compiling is expensive, could easily 
> internally do the "is it valid"-type check before compiling. Having it 
> in the interface adds no functionality that is not already easily available.

You're missing the part where I said "on-the-fly".  If it _is_ valid,
this will be unacceptably slow if you're only interested in providing
feedback to the user whether their currently entered expression is
valid or not.  I don't think this feature is far-fetched: programs
like RegexBuddy do this, and an enhanced Scheme IDE could also do
something like that.

The valid-sre? test is more primitive, and it doesn't make sense to
wrap this up in the constructor, requiring people to create a complete
regex object (with the overhead and memory garbage it creates) just
to get at this information is a bad idea.