GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||
GeezerVison is showing github.com — util: isDeepStrictEqual always returns false to compare WeakMap/WeakSet by yosuke-furukawa · Pull Request #18228 · nodejs/node Conversation
Member
solve #18227 Checklist
Affected core subsystem(s)util
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
|
There was an error while loading. Please reload this page.
|
I thought about this before and I feel like the current way is the more correct one. The comparison always relies on what is possible to detect. Since This PR will also make it impossible to distinguish differences like these: const a = new WeakMap(); const b = new WeakMap(); const c = new WeakMap(); c.isClearlyDifferent = true; util.isDeepStrictEqual(a, b); // => false even though they are indeed equal util.isDeepStrictEqual(a, c); // => false without distinguishing this from the former check Because of those reasons I am -1 on landing this. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I wonder if it wouldn't be better to throw when one of the arguments is a |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@jasnell hm... I am not certain if it is a good default behavior. But there is again no definite right or wrong. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@jasnell my ideal is so, they are not comparable then throw an Error. First I feel JavaScript engineers do not like Error so much. so I implemented this behavior, but some core members thinks |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
As stated in #18248 (comment), I don't see why WeakMap and WeakSet should be treated differently from regular objects. Thus, -1 on this PR.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Right now it is not documentated that WeakMap entries are not compared. This might result in some confusion. This adds a note about the behavior in `assert.deepStrictEqual`. This documentation is also references in `util.isDeepStrictEqual`, so we do not have to document it again for that function as the underlying algorithm is the same. PR-URL: nodejs#18248 Fixes: nodejs#18228 Refs: nodejs#18228 Reviewed-By: Joyee Cheung <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
Right now it is not documentated that WeakMap entries are not compared. This might result in some confusion. This adds a note about the behavior in `assert.deepStrictEqual`. This documentation is also references in `util.isDeepStrictEqual`, so we do not have to document it again for that function as the underlying algorithm is the same. Backport-PR-URL: #19230 PR-URL: #18248 Fixes: #18228 Refs: #18228 Reviewed-By: Joyee Cheung <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
Right now it is not documentated that WeakMap entries are not compared. This might result in some confusion. This adds a note about the behavior in `assert.deepStrictEqual`. This documentation is also references in `util.isDeepStrictEqual`, so we do not have to document it again for that function as the underlying algorithm is the same. Backport-PR-URL: #19230 PR-URL: #18248 Fixes: #18228 Refs: #18228 Reviewed-By: Joyee Cheung <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
Right now it is not documentated that WeakMap entries are not compared. This might result in some confusion. This adds a note about the behavior in `assert.deepStrictEqual`. This documentation is also references in `util.isDeepStrictEqual`, so we do not have to document it again for that function as the underlying algorithm is the same. PR-URL: nodejs#18248 Fixes: nodejs#18228 Refs: nodejs#18228 Reviewed-By: Joyee Cheung <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.