Skip to content

Why not impl Eq for globset::GlobMatcher? #2581

Closed Answered by BurntSushi
YeungOnion asked this question in General
Discussion options

You must be logged in to vote

I don't think there's any particular reason. And to be honest, I'm not a huge fan of implementing PartialEq or Eq on Glob (or GlobSet) itself. There's an ambiguity there about what PartialEq/Eq actually means. For the regex crate, for example, I chose not to implement PartialEq/Eq for Regex for what is essentially that reason: does equality mean that the same pattern was used to build two distinct Regex values, or does equality mean that the two distinct Regex values match precisely the same set of strings? The latter has a precisely defined meaning for regular languages, but is unfortunately quite expensive to compute. I reckon the same is true of globs. For example, should the two globs a

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@BurntSushi
Comment options

Answer selected by YeungOnion
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants