Hi

On 9/23/26 21:01, Gina P. Banyard wrote:
                public function __construct(
                        string $pattern,
                        bool $caseSensitive = true,
                        bool $greedy = true,
                        bool $anchor = false,
                        bool $multiLine = false,
                        bool $dotMatchesNewLine = false,
                        bool $ignoreWhitespace = false,
                        bool $captureOnlyNamedGroups = false,
                        bool $allowDuplicateSubPatternNames = false,
                ) {}

Similar to what the others mentioned, I'm not happy with the constructor, for two reasons:

1. I feel that named constructors work much better if there are multiple equally valid ways of constructing a value object, which likely is the case here with “undelimited pattern” and “delimited pattern including modifiers” and possible future additions. Some of the flags could potentially even be built into the constructors name (switching between Unicode / Bytestring support).

2. The order of the flags is pretty much arbitrary, making discoverability hard because IDEs typically suggest parameters in the order they appear in.

We likely want the most common flags first, which then would become ugly if later adding additional flags which are expected to be commonly used.

Since the parameters are intended to be used as “named parameter only”, we should likely first have some mechanism to prevent parameters from being used positionally, similarly to what I think Python supports.

Best regards
Tim Düsterhus

Reply via email to