generated from ponylang/library-project-starter
-
-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
I've found myself in the position where I've hacked a local copy of this library to support the PCRE2_MULTILINE option. I think it might be nice to let users pick and choose options when compiling patterns, but I'm not sure about the best way to do that.
- Creating primitives and using
collections.Flagsmight be one way, but that would necessitate passing another argument toRegex.create(), which raises the issue of positioning the argument.flagsbeforejitbreaks compatibility with existing code.flagsafterjitmeans that any user who wants to set flags would have to also choose whether or not to jit-compile the pattern, adding boilerplate. - Another option might be to absorb the
jitargument into aFlagsobject, but that would also break compatibility. - One way to not break compatibility or add boilerplate might be to expose
fun ref pattern_options() ?, but that method would have to recompile the pattern, which is a bit of a waste. - Exposing something like
new with_opts(from: ByteSeq box, jit: Bool = true, flags: PCRE2Flags = ...)seems like a good option. It's my favorite at the moment.
I'm open to other ideas, and I'd be glad to contribute this enhancement once I have a better idea of what we want for this library.
Metadata
Metadata
Assignees
Labels
No labels