-
Notifications
You must be signed in to change notification settings - Fork 88
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
If higher-order combinator #216
Comments
This sort of makes me think more that matchers should have a heap of methods on them. e.g. p.implies(q) p.after(f).on_mismatch(g) But each such method added has a huge impact on compatibility. The I don't know the solution to it, but I suspect that requiring the |
I agree with @jml. I'd be concerned about adding any complexity to the matcher API. I'm also not entirely sure what the use case is for this. What tests are currently awkward to write that this would resolve? |
+1 on being able to propogate the message from an annotated matcher to a higher order matcher. I think calling a matcher that matches with what you wrote 'If' would be very confusing, because
looks for the truthiness of foo, whereas you're looking for whether p->q has been disproven. I don't think we should have a heap of methods on matchers. What methods should we add? Why? Why those and not others? |
The analogy is that this:
is equivalent to this:
I can see how that might be confusing, though. |
In boolean logic: (p → q) ⇒ ¬p ∨ q
Therefore we can define:
I didn't supply a patch yet because I thought kicking the idea around a bit might draw out some useful tweaks to the API; for example, what about the common case of
If(MatchesPredicate(..., "message that will never be seen"), ...)
?The text was updated successfully, but these errors were encountered: