-
Notifications
You must be signed in to change notification settings - Fork 14
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
Null >= 0 weird behavior #13
Comments
There are other places we've decided to forge a brand "JsonLogic way" -- especially Truthy and Falsy. http://jsonlogic.com/truthy.html Arguably we could do the same thing for null behavior, but I think you're the first person to ask about it. Interestingly, PHP and JavaScript disagree on whether |
I don't think that this behavior is logically consistent. Making a decision on this is much better then depending on quirks of the language to determine the result. |
Yep, this just bit me aswell: I've fixed it (for my application, might not work for yours) by checking the value too (and making an exemption for
Data:
|
Well, there has been some heat in other places around building type-safe language implementations, where I'm struggling to come up with a "successful" example JL could look up to. We could make null "infectious" so every comparison with null returns null... I think this is SQL's answer to the problem, and it has the virtue of being self-consistent. https://dev.mysql.com/doc/refman/8.0/en/working-with-null.html That way we don't have to write a giant comparison matrix (is null greater than or equal to an object with no properties?) |
When comparing null values to 0 with the
>=
operator , I get the following result:{">=" : [null,0]} //result is true
However, these operators yield the results:
{">" : [null,0]} //result is false
{"==" : [null,0]} // result is false
{"===" : [null,0]} // result is false
I would expect the result of
{">=" : [null,0]}
to be false as well, is there any reason that it is not the case?The text was updated successfully, but these errors were encountered: