facebook / facebook/folly

dynamic.h operator== claiming to do a deep equal comparison but its not

Open
#2,424 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
30.5k
Forks
5.9k
PR merge metrics
No merged PRs in 30d

Description

In the `json/dynamic.h` its saying that the equal operator will do a deep equal comparison:

https://github.com/facebook/folly/blob/08d6d55dc9d01d99a948f4a1d9aa9d5f84aba494/folly/json/dynamic.h#L293-L301

but looking into the implementation if the types are matching its just comparing the address:

https://github.com/facebook/folly/blob/08d6d55dc9d01d99a948f4a1d9aa9d5f84aba494/folly/json/dynamic.cpp#L119-L131

Maybe I am missing something but it seems to me that his is incorrect and no actual deep equal comparison? (I am looking for a built-in way to do a deep equal compare)

Contributor guide

Open the contributing guide

Research direction

Start with the operator== declaration and documentation in json/dynamic.h at lines 293-301, then inspect its implementation in json/dynamic.cpp at lines 119-131. Compare the documented deep-equality behavior with the matching-type comparison shown there. Done means the operator's behavior and documentation clearly agree, with the deep-comparison question resolved.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
api
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.