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

problems with frozen dataclass and hashable requirements of Meaning #28

Closed
nathimel opened this issue Feb 4, 2024 · 1 comment
Closed
Assignees

Comments

@nathimel
Copy link
Collaborator

nathimel commented Feb 4, 2024

We need to either represent the prior not as a dict, or do something different with the dataclass implementation, because the the dict is not hashable.

Grammar enumeration, but probably other things too, expect a Meaning to be hashable. But as a frozen dataclass this means we can't use a dict to represent the prior over referents. E.g.
https://github.com/CLMBRs/ultk/blob/main/src/ultk/language/grammar.py#L316
results in
*** TypeError: unhashable type: 'dict'

The hashability of the list of referents is related to this. We assumed it could be an iterable, and our tests pass a list, but a list is not hashable. #26

Happy to represent the prior as simply a tuple, since I've proposed requiring referents to be a tuple. So recovering order for the mapping won't be a problem, and we can still have a function that returns the dict.

@nathimel
Copy link
Collaborator Author

nathimel commented Feb 4, 2024

And this means that Universe will also have to change since it assumes a prior

@nathimel nathimel self-assigned this Feb 4, 2024
@nathimel nathimel closed this as completed Feb 4, 2024
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