candoumbe / candoumbe/DataFilters
✨ add a timeout to the `ToFilter<T>()` extension method
- Dominant language
- C#
- Stars
- 33
- Forks
- 5
- Avg merge
- 15h 50m
- Merged PRs (30d)
- 17
Description
**Is your feature request related to a problem? Please describe.**
Some naughty strings like groups can cause `StackOverflowException`.
**Describe the solution you'd like**
One way to prevent that could be to let the caller submit a "timeout" duration like what the BCL provides when calling [Regex.IsMatch]()
```csharp
ReadonlySpan input = ...;
var filter = input.ToFilter(timeout: TimeSpan.FromSeconds(30));
```
By explicitly defining a timeout, the developer would acknowledged that converting the input could fail.
Going one step further could be to introduce a breaking change in the `ToFilter` extension method and make it returns an `Option`
**Describe alternatives you've considered**
I could try to prevent those stack overflow by analyzing the input and eliminating cases where `GroupExpression` are nested too deeply, either with a global parameter (like [the "maxdepth" parameter System.Text.Json](https://docs.microsoft.com/en-us/dotnet/api/system.text.json.jsonserializeroptions.maxdepth?view=net-9.0#system-text-json-jsonserializeroptions-maxdepth) provides
**Additional context**
Add any other context or screenshots about the feature request here.
Contributor guide
Assessment
This issue has not been assessed yet.