[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 11/26/2013 11:52 AM, Kevin Wortman wrote:
The only use case for 'valid-sre?' mentioned so far is Peter's
interactive regular expression IDE. The C standard does not require the
-fsyntax-only option. These do not seem like compelling arguments for
There is a well-established Scheme idiom that every client-visible data
type have a constructor, and a type predicate such as valid-sre? . In
general user-created data types don't have explicit names in the source
code, so the type predicate may stand for the type itself in
documentation and comments. Speaking for myself, when learning about a
new library the first thing I do is read about all the type predicates
since they enumerate the relevant data structures and roughly how they

In terms of practicalities, sanity-checking predicates such as
valid-sre? are helpful for error checking and interactive debugging.
They are also necessary for specifying contracts on procedures. See e.g.
which depends upon every data type having a type predicate.

Kevin Wortman

An <sre> is not a data type. It is a language. This is like having 'valid-syntax?' to check an expression before you call 'eval' with it.