You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Proposal: Add hash sets to the standard library #6919
proposalThis issue suggests language modifications. If it also has the "accepted" label then it is planned.standard libraryThis issue involves writing Zig code for the standard library.
Hash sets can be currently be done using AutoHashMap(K, void) but I'd argue that an actual hash set type would make working with them much nicer. Using a hash map, you have to explicitly access the key member of an Entry to get the value (and I sometimes accidentally try value first instead since when used as a set, the keys are the values), pass {} as the value every time you add something, and you have member functions that are meaningless when using it as a set. With a HashSet type you wouldn't have that cruft, and specific operations for working with sets could even be added if desired.
Reacted by Dmitry Atamanov, frmdstryr, Komu Wairagu, Bhargav Srinivasan, Hlöðver Sigurðsson, Gonzalo Diethelm, BurnySc2, Mike Hogye, Matthew Streatfield, Lewis Gaul and 54 more
Reacted by LuizZzZzzZ, Fifnmar, Julian V., Luca Venir, Nicola Larosa and Miguel Villa Floran
Personally, I am currently not sure what's the best way to perform quick Set O(n) computations, such as difference, intersection, union, etc. with AutoHashMap alone
Just curious if this is this not done just because no one has done it yet, or because of thoughts that is possibly not needed? Would it be worth someone's time looking at implementing this?
proposalThis issue suggests language modifications. If it also has the "accepted" label then it is planned.standard libraryThis issue involves writing Zig code for the standard library.
Activity
VoilaNeighbor commentedon Aug 31, 2023
I wonder why this proposal is still awaiting approval. It doesn't seem to incur any harm to the standard library.
lucavenir commentedon Dec 3, 2023
Personally, I am currently not sure what's the best way to perform quick
SetO(n) computations, such as difference, intersection, union, etc. withAutoHashMapaloneteknico commentedon May 13, 2024
Meanwhile, the author of the well-regarded
golang-setlibrary is writing ziglang-set.loftafi commentedon Mar 26, 2025
Just curious if this is this not done just because no one has done it yet, or because of thoughts that is possibly not needed? Would it be worth someone's time looking at implementing this?