Skip to content

hashmap-init-update #974

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

Merged
merged 10 commits into from
Apr 15, 2025
Merged

Conversation

chuckyvt
Copy link
Contributor

@chuckyvt chuckyvt commented Apr 3, 2025

This PR is to update the hashmap initialization routine to be more user friendly. It does two things:

  • Changes hasher to be an optional argument instead of required, with the default being fnv_1_hasher if no hasher is specified.
    This perhaps was the original intent of the code, as the abstract base hashmap class sets the hasher to fnv_1_hasher, but then the downstream init functions currently require the hasher to be specified again. I believe the choice of hasher function should be abstracted away for the majority of users.

  • Includes a logical flag initialized to track initialized state, and if a map_entry call is made prior to initializing, it will call the init routine using default arguments.
    I believe this is a relatively simple ease of use feature, that will make the hashmaps more in line with implicit initialization commonly used with other languages (but init can still be explicitly called if needed).

Includes code updates, doc, test and example updates for initialize update.
Copy link
Member

@perazz perazz left a comment

Choose a reason for hiding this comment

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

Nice improvement @chuckyvt, looks good imho.

Copy link
Member

@jvdp1 jvdp1 left a comment

Choose a reason for hiding this comment

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

Thank you @chuckyvt ! LGTM! Here are some minor comments

chuckyvt and others added 9 commits April 3, 2025 08:00
Co-authored-by: Jeremie Vandenplas <jeremie.vandenplas@gmail.com>
Co-authored-by: Jeremie Vandenplas <jeremie.vandenplas@gmail.com>
Co-authored-by: Jeremie Vandenplas <jeremie.vandenplas@gmail.com>
Added code to update initialization flag at the end of the init routine.
Co-authored-by: Jeremie Vandenplas <jeremie.vandenplas@gmail.com>
@chuckyvt
Copy link
Contributor Author

chuckyvt commented Apr 4, 2025

Added the suggested changes. Also realized I forgot to update init so that it updates the initialization flag to true and added that. This PR is complete as far as I know. The last update shows a CI failure that is not related to hashmaps.

@perazz
Copy link
Member

perazz commented Apr 14, 2025

Thank you @chuckyvt. @jvdp1 I believe all the comments have been addressed by @chuckyvt. I think this can be merged soon if you also think so.

Copy link
Contributor

@jalvesz jalvesz left a comment

Choose a reason for hiding this comment

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

LGTM @chuckyvt I think this PR is ready to be merged

Copy link
Member

@jvdp1 jvdp1 left a comment

Choose a reason for hiding this comment

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

LGTM. Thank you @chuckyvt

@perazz
Copy link
Member

perazz commented Apr 15, 2025

With three approvals, I will merge. Thank you @chuckyvt @jvdp1 @jalvesz.

@perazz perazz merged commit 6aa5177 into fortran-lang:master Apr 15, 2025
23 of 24 checks passed
@chuckyvt chuckyvt deleted the hashmap-init-update branch April 21, 2025 02:52
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.

4 participants