fortran-lang / stdlib

Fortran Standard Library
https://stdlib.fortran-lang.org
MIT License
1.02k stars 161 forks source link

Hashap key generic interfaces #827

Closed chuckyvt closed 2 weeks ago

chuckyvt commented 1 month ago

This is update to the hashmap capabilities to include generic key interfaces for most of the type-bound procedures that use key type. I believe this will be a nice step forward for the user interface, reducing number of lines of code to use the hashamaps, and makes it closer to the style of a dictionary in Python.

For example, currently to map an entry:

call set( key, [1] )
call map % map_entry( key, other, conflict )

This simplifies to call map % map_entry( [1], other, conflict )

This is the initial submit with src and testing updated for review. Will work on specs and adding examples next.

chuckyvt commented 1 month ago

I believe this is ready for review. There was a single CI failure that I don't understand, but doesn't appear to be related to the code updates?

chuckyvt commented 1 month ago

Also worth mentioning that some of the hashmap examples were somewhat outdated, assuming the hashmap capabilities have matured since the examples were written. In one example there was a routine written, key_to_char, to convert a key back to a character string. Since the get function does this exact task, the example was updated to use the get function instead of using a custom function.

jvdp1 commented 1 month ago

Is this PR related to #664 ? (I don't think so, but just to be sure).

chuckyvt commented 1 month ago

They are unrelated. This PR only affects the 'key' field. No changes to 'other'.

chuckyvt commented 3 weeks ago

Thanks for the detailed review. I believe all requested changes have been included.

jvdp1 commented 2 weeks ago

@chuckyvt : Could you rebase this PR, please (to check if it solves the CI issue)?

jvdp1 commented 2 weeks ago

Thank you @chuckyvt . I will wait a couple of days before merging, in case of additional comments.