-
Notifications
You must be signed in to change notification settings - Fork 25
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
Incorrect behaviour of logical not #64
Comments
Or is it that boolean literals aren't evaluated as boolean expressions? |
Not going to justify the implementation here, just to confirm your observation: Proposal A here parses to the Now, what would we expect? |
The syntax doesn't rule out literals "on their own", which I suppose would be one (perhaps rather draconian) option. I don't think it makes sense to try to attach meaningful boolean values to string, numeric, and However, for boolean literals, there is an obvious intuition and I think we should support it. A boolean literal should denote the corresponding Apart from reducing the surprise factor, there may be a use case for this. Suppose someone is debugging a complex filter. They may wish to temporarily replace some of the predicates inside the filter with |
Sorry, guys, just pressed wrong button. I agree that true/false literals should have clear boolean semantics. What about other standalone literals - I've just forbid them on grammar level in my implementation, so the user can get the early feedback. |
What do you think of https://cburgmer.github.io/json-path-comparison/results/filter_expression_with_equals_boolean_expression_value.html ? Is that comparable? For me what links the queries here is that |
It's similar, but that is treating predicates as booleans rather than treating boolean literals as predicates, so we could make a distinction on that basis. It reminds me of certain languages which have predicates but no boolean type. |
I agree that the constants currently are not helpful, borderline misleading. I created #66 to address that. Let me know what you think please. We would have to make a slightly bigger change to support boolean values as part of the logic, I suggest we address this in a second change. Let's talk more about what we want there. I'd like to understand the bigger picture. |
I have yet to understand the real benefit of supporting this. |
I think I need to process a bit more what you initially wrote @glyn. Apologies that I didn't initial react to that, I think I need some quiet moment to reflect on the problem at hand.
I read this as
And here I understand you are calling for a more general predicate, so we can write something like
This is about whether to allow constants other than And I understand this is a separate thing from trying to assign predicates a value that can be tested in the filter expression in a dedicated way (like I'll think a bit on that, and will add a few more queries to probe into support of the implementations. |
Yes, that's what I meant.
Yes.
Yes, and I don't yet understand the benefit of supporting
That will be useful, thanks. |
Looking at the queries added, there's spotty support for true/false in predicates, and some less intuitive responses as well ("looks buggy"). The more I think about it, the less reasons I see not support that. I am probably mostly grappling with |
Alternatives are:
We've been talking about the debugging mission of |
@remorhaz I'd prefer to avoid completely new constructs. |
I've been take a look at predicates like |
@cleidiano Yes, that approach works if people think of using |
Me too, but I think we should keep in mind such possibility if existing syntax doesn't allow solution good enough. |
It seems that logical not (
!
) in filters in Proposal A doesn't work as expected. For example:The text was updated successfully, but these errors were encountered: