Skip to content

Avoid some invalidations related to Base.hash#123

Merged
ederc merged 1 commit intoalgebraic-solving:mainfrom
lgoettgens:lg/hash-invalidations
Feb 20, 2026
Merged

Avoid some invalidations related to Base.hash#123
ederc merged 1 commit intoalgebraic-solving:mainfrom
lgoettgens:lg/hash-invalidations

Conversation

@lgoettgens
Copy link
Copy Markdown
Contributor

According to the julia docs, new types should implement the 2-argument version of hash, as this allows for composeability of hashing and there exists a generic delegation from the 1-arg to the 2-arg version in julia base. Not adhering to this leads to a bunch of invalidations, i.e. basically all methods that uses Base.hash in their body need to be re-compiled once this method from AlgebraicSolving is loaded (cf. oscar-system/Oscar.jl#2525).

Furthermore, the julia docs state that Base.hash should always return a UInt (i.e. a 64-bit unsigned int on most systems). I added compliance with that by splitting the function into one named Base.hash that returns a UInt, and one named hash_monomial that returns a MonHash (aka UInt32).

cc @fingolfin

@ederc ederc merged commit 46c3dd4 into algebraic-solving:main Feb 20, 2026
8 checks passed
@ederc
Copy link
Copy Markdown
Collaborator

ederc commented Feb 20, 2026

Thanks!

@lgoettgens lgoettgens deleted the lg/hash-invalidations branch February 20, 2026 20:01
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.

2 participants