Skip to content
This repository has been archived by the owner on Nov 6, 2022. It is now read-only.

Values of different types should always have different hashes #3

Open
edfelten opened this issue May 7, 2020 · 1 comment
Open
Labels
bug Something isn't working

Comments

@edfelten
Copy link
Contributor

edfelten commented May 7, 2020

At present we hash a value by computing the AVM hash of its AVM representation. This means that some objects that have different types at the language level can have equal hashes.

This is confusing, and it violates the expectation that two values test as equal if and only if their hashes are equal.

The fix is to include some kind of type-code into the hash. For compound types, the type code could be constructed by hashing together values the component types, in appropriate ways. (The type codes would all be computed at compile time.)

One tricky aspect of the type-codes business is that we would need to have the linker propagate type-codes of exported/imported types across files. Otherwise the results would be surprising--a client to an interface could have a different hash value than the implementer of the interface, for the same value.

@edfelten edfelten added the bug Something isn't working label May 7, 2020
@edfelten
Copy link
Contributor Author

Closed this by mistake. It's not actually duplicative of #1.

@edfelten edfelten reopened this May 21, 2020
rachel-bousfield added a commit that referenced this issue Sep 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant