Hi
On 9/25/26 17:08, Jordi Kroon wrote:
For the prototype I've only added support to use this new class to the
preg_split() and preg_grep() functions as they were easy to tweak.
Is it by design that this class does not have a `__toString()` method.
Similarly to backed enums, I also consider `__toString()` to be a
mistake, because there is generally not a single obvious scalar / string
representation, which you also acknowledge yourself: Delimiters would
need to be invented out of thin air - and modifiers are not necessarily
portable across programming languages or regex engines.
And would you consider adding it? It would potentially allow the stubs
for the exiting functions to stay unchanged. This would be similar to
what the Uri API is doing, however it would require some sort delimiter
generation I suppose.
I don't follow the reference to the URI API. It specifically doesn't
have a __toString() implementation.
And if we are going that direction, how about we add a `::fromString()`,
to make it easier to migrate to this new API? And make use of it's
Validation ability.
That however would make sense to me, but it would likely need a better
name, because it's a *specific* string format that is expected.
Best regards
Tim Düsterhus