-
Notifications
You must be signed in to change notification settings - Fork 32
Description
This issue emerged from #153 .
The method TermMatcher::constant offers implementers a way to optimize their processing of TermMatchers: instead of naively generating all triples and filtering them using TermMatcher::matches, they can use the constant term to only generate the necessary triples.
This is very well for some implementations, but it makes it impossible to optimize on more complex matchers, which some implementations could do. It might be interesting to extend TermMatcher::constant into a more complex method(call it optimizationHint for example), which would return an enum as suggested below. Different implementations would be able to take advantage of different kinds of hints...
Proposal:
enum TermMatcherHint {
NoHint, // you need to call the match method...
Constant(Term), // matches a unique term
List(Vec[Term]), // matches a pre-determined list of terms
Range(Term, Term) // matches any term in the given range (given some total order on terms)
// ... anything else?
}NB: Any would still return NoHint, and that's OK, because calling Any::match, which is implemented as { return true }, will be optimized away anyway.