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

Make SolverInterface use BTreeMap instead of HashMap #531

Open
niklasdewally opened this issue Dec 2, 2024 · 0 comments
Open

Make SolverInterface use BTreeMap instead of HashMap #531

niklasdewally opened this issue Dec 2, 2024 · 0 comments
Assignees

Comments

@niklasdewally
Copy link
Collaborator

BTreeMap implements Eq and Hash, which are useful things to do to solution sets

niklasdewally added a commit that referenced this issue Jan 10, 2025
Change type of `SymbolTable` from `HashMap` to `BTreeMap`.

`BTreeMap` gives variables an ordering in the symbol table, allowing
them to be printed in a deterministic order. It also implements `Eq`,
and `Hash`, which will allow us to compare symbol tables to each other
in the future.

Previously, with a `HashMap`, the key ordering was unspecified, so they
could be printed in any order. The keys printing in a different order in
the expected and generated test files broke some tests.

We plan to convert more `HashMaps` to `BTreeMaps` in the future for
similar reasons. For example, using it for solution sets will allow us
to compare them easier (due to implementing `Eq` and `Hash`) [#531].
niklasdewally added a commit that referenced this issue Jan 10, 2025
Change type of `SymbolTable` from `HashMap` to `BTreeMap`.

`BTreeMap` gives variables an ordering in the symbol table, allowing
them to be printed in a deterministic order. It also implements `Eq`,
and `Hash`, which will allow us to compare symbol tables to each other
in the future.

Previously, with a `HashMap`, the key ordering was unspecified, so they
could be printed in any order. The keys printing in a different order in
the expected and generated test files broke some tests.

We plan to convert more `HashMaps` to `BTreeMaps` in the future for
similar reasons. For example, using it for solution sets will allow us
to compare them easier (due to implementing `Eq` and `Hash`) [#531].
@niklasdewally niklasdewally self-assigned this Jan 14, 2025
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

No branches or pull requests

1 participant