New option for parsing behaviour of invalid **
See original GitHub issueAs per discussion on #68
The pattern **abc
should not match abc
it should throw an exception by default, This is because as per the read me, if the **
token is used it must be the only content of a segment.
These patterns are a few examples that should all throw:
**abc
foo/bar**
foo**/
/foo**bar/
Update as result of discussion below: However there are use cases where its desirable to not throw, but instead, parse such invalid usage of double star, to mean two single stars instead. In this situation, instead of throwing when failing to parse an wildcard directory token, it would instead, parse two wildcard tokens (which do not match past current path seperator). However I will make this behaviour “opt in” via setting an option on GlobOptions, as it subverts the behaviour of ** to be interpreted as two single stars, where one single star would suffice, and where using two stars should not otherwise be valid in a glob pattern.
Issue Analytics
- State:
- Created 4 years ago
- Comments:9 (4 by maintainers)
Top GitHub Comments
Hi Darell,
thank you for responding my comment.
to be clear: I just gave my two cents, so it’s perfectly fine to disagree and of course it’s your decision. So there is no need to vindicate anything. I’m thankful that you make this library available as open source.
You’re right that dotnet.glob allows all theses usages (opt-in). I just wanted to mention that using some global config/singleton option IMHO might result in code where some people (like me) see disadvantages like side-effects / hidden behavior / possible copy&paste errors. I’ve seen this with e.g. Newtonsoft.Json and I created things like this in my own code multiple times, too… I think this sometimes results in “bad” (near-sighted) defaults like non-strict behavior (because you can “easily” change it, example). Nowadays I think allowing global/singleton config is mostly an anti-pattern. But: just my 2 cents.
Regarding LanguageExt: You probably won’t use it if you care about size. 😃 The library is really huge (but worth every byte). Additionally I don’t know how fast it is. Performance isn’t the main goal of LanguageExt, but Louthy is aware that performance matters.
Kind regards
Yes of course, thats’s perfectly fine!