Skip to content

custom equals/hashCode for dictionary nodes.#929

Merged
lpil merged 2 commits into
gleam-lang:mainfrom
yoshi-monster:dict_collision_equality
May 30, 2026
Merged

custom equals/hashCode for dictionary nodes.#929
lpil merged 2 commits into
gleam-lang:mainfrom
yoshi-monster:dict_collision_equality

Conversation

@yoshi-monster
Copy link
Copy Markdown
Contributor

fix #928

this makes dictionary Nodes a real class, such that I can override equals and hashCode in a more idiomatic manner.

For overflow nodes, the order of items in the final arrays was not guaranteed, so in that program of the issue, structural comparison did not work anymore.

Fun side-effect of all of that that maybe makes adding another 100 lines to the dict implementation worth it is that equality is now 10 times faster, I guess. I tried a bunch of things trying to compress all the tree walking methods but I couldn't come up with anything good -.-

anyways, ~ 💜

@yoshi-monster yoshi-monster force-pushed the dict_collision_equality branch from c3a51d1 to 24816cd Compare May 29, 2026 20:17
Copy link
Copy Markdown
Member

@lpil lpil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahhh amazing!! Thank you!!

@lpil lpil merged commit abab8d5 into gleam-lang:main May 30, 2026
7 checks passed
@yoshi-monster yoshi-monster deleted the dict_collision_equality branch May 30, 2026 19:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Javascript target dictionary equality is inconsistent

2 participants