Skip to content

Use ordermap instead of hashmap for backing arrays#126

Open
ghuls wants to merge 1 commit intoezrosent:masterfrom
ghuls:order_map
Open

Use ordermap instead of hashmap for backing arrays#126
ghuls wants to merge 1 commit intoezrosent:masterfrom
ghuls:order_map

Conversation

@ghuls
Copy link
Contributor

@ghuls ghuls commented Sep 24, 2025

Use ordermap instead of hashmap for backing arrays as this allows iterating over arrays in a for loop in insertion order, like gawk.

Use ordermap instead of hashmap for backing arrays as this allows
iterating over arrays in a for loop in insertion order, like gawk.
@ghuls
Copy link
Contributor Author

ghuls commented Sep 24, 2025

Don't merge yet as it will need some additional changes after environment_variables branch is merged.

This makes code like this work, like it does in gawk: #107 (comment)

It probably would also make it relatively trivial to support some of the gawk array sorting functions later:
https://www.gnu.org/software/gawk/manual/html_node/Array-Sorting-Functions.html
https://www.gnu.org/software/gawk/manual/html_node/Controlling-Scanning.html

https://docs.rs/ordermap/0.5.10/ordermap/map/struct.OrderMap.html#method.sort_unstable_keys

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.

1 participant