You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm wondering why Eq is not implemented for the Number struct. At first, I thought it was because Number can also represent NaN for which we usually expect that NaN != NaN. However a rapid glance at the implementation showed me that in the implementation of PartialEq, we have NaN == NaN.
Having Eq would be useful to use Number or even JsonValue in containers like HashSet.
Also why do you need to represent NaN in Number? As far as I know there is no NaN in JSON, right?
The text was updated successfully, but these errors were encountered:
NaN on Number is here purely for conversions from f64. I'm okay with it being removed (along with From) as long as there is a conversion from f64 for JsonValue that produces Null for NaN floats (since that seems to be the expected behavior).
@PurpleMyst with the stuff mentioned above, if you want to submit a PR, go for it :).
I'm wondering why
Eq
is not implemented for theNumber
struct. At first, I thought it was becauseNumber
can also representNaN
for which we usually expect thatNaN != NaN
. However a rapid glance at the implementation showed me that in the implementation ofPartialEq
, we haveNaN == NaN
.Having
Eq
would be useful to useNumber
or evenJsonValue
in containers likeHashSet
.Also why do you need to represent NaN in
Number
? As far as I know there is no NaN in JSON, right?The text was updated successfully, but these errors were encountered: