Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assert possible hash functions in RHASH_ST_TABLE #7107

Merged
merged 1 commit into from Jan 12, 2023

Conversation

k0kubun
Copy link
Member

@k0kubun k0kubun commented Jan 12, 2023

Because of the function pointer, it's hard to figure out what hash functions could be used in Hash objects when st_lookup is used.

Having this assertion makes it easier to understand what hash_stlike_lookup could possibly do. (AR uses only rb_any_hash)

For example, this clarifies that hash_stlike_lookup never calls a #hash method when a key is T_STRING or T_SYMBOL.

Because of the function pointer, it's hard to figure out what hash
functions could be used in Hash objects when st_lookup is used.

Having this assertion makes it easier to understand what
hash_stlike_lookup could possibly do. (AR uses only rb_any_hash)

For example, this clarifies that hash_stlike_lookup never calls a #hash
method when a key is T_STRING or T_SYMBOL.
@k0kubun k0kubun marked this pull request as ready for review January 12, 2023 06:53
@k0kubun k0kubun merged commit d4a3882 into ruby:master Jan 12, 2023
@k0kubun k0kubun deleted the assert-hash branch January 12, 2023 07:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant