17226, "leekillough", "Should tertiary methods be defined for regexp?", "2021-02-22T22:07:00Z"
Should tertiary methods be defined for regexp
?
Method Description proc string.search(needle: string, ignorecase=false):reMatch
Search for needle regexp in string proc bytes.search(needle: bytes, ignorecase=false):reMatch
Search for needle regexp in bytes proc string.search(needle: regexp(string)):reMatch
Search for a compiled regexp in string proc bytes.search(needle: regexp(bytes)):reMatch
Search for a compiled regexp in bytes proc string.match(pattern: regexp(string)):reMatch
Match a regexp to string proc bytes.match(pattern: regexp(bytes)):reMatch
Match a regexp to bytes proc string.match(pattern: regexp(string), ref captures ...?k):reMatch
Match a regexp in string, returning captures proc bytes.match(pattern: regexp(bytes), ref captures ...?k):reMatch
Math a regexp in bytes, returning captures iter string.split(pattern: regexp(string), maxsplit: int = 0)
Split string with regexp iter bytes.split(pattern: regexp(bytes), maxsplit: int = 0)
Split bytes with regexp iter string.matches(pattern:regexp(string), param captures=0, maxmatches:int=max(int))
Returns matches and captures on string iter bytes.matches(pattern:regexp(bytes), param captures=0, maxmatches:int=max(int))
Returns matches and captures on bytes
-
Do we want to define tertiary methods which operate on
string
andbytes
, or should we keep the number of interfaces smaller, and only provide methods onregexp
class?
The methods onregexp
are generic, and work for eitherstring
orbytes
, while the tertiary methods have to be defined forstring
andbytes
separately, but they are usually just wrappers to the genericregexp
methods. -
Do we want to provide methods which compile regular expressions "on the fly" (caching the compiled result), or should we require the user to compile the regexp separately?