-
-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cty: Allow capsule types inside set values
Previously cty would just panic if a caller tried to put values inside a set whose element type is or contains a capsule type, because the set rules lacked a hashing algorithm for those. Now we have a hash implementation for capsule types. Ideally a capsule type intended for use in sets should have a CapsuleOps that defines both Equals and HashKey for the set implementation to rely on, but there is also a less-efficient fallback behavior for types without HashKey (just bucket them all together and scan) and a less-useful fallback behavior for types without Equals (pointer equality of the encapsulated pointer, as usual). This now makes it safe to use capsule types in a system that also makes use of sets of arbitrary types.
- Loading branch information
1 parent
74095df
commit b66d00a
Showing
5 changed files
with
159 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters