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

State clearly in the documentation that the iteration of a Set occurs in undefined order #23269

Closed
cossio opened this issue Aug 15, 2017 · 4 comments
Labels
docs This change adds or pertains to documentation Hacktoberfest Good for Hacktoberfest participants

Comments

@cossio
Copy link
Contributor

cossio commented Aug 15, 2017

Since Sets hash items depending on memory locations, this is not deterministic. Therefore iterating over a Set will traverse items in undefined order.

This behaviour has been the cause of some hard to find bugs for me. I am not saying that there is something wrong with it, but it should be clearly stated in the documentation, so that we are alert.

@JeffBezanson JeffBezanson added the docs This change adds or pertains to documentation label Aug 15, 2017
@JeffBezanson
Copy link
Member

depending on memory locations

The results of hash functions that don't depend on memory locations aren't exactly predictable either. While the same from run to run, one still shouldn't depend on the order.

@JeffBezanson
Copy link
Member

ref #12198

@Zapiano
Copy link

Zapiano commented Oct 2, 2023

Is this issue still relevant? Julia's documentation about Set says: "The order of elements in a Set is an implementation detail and cannot be relied on." Should it be more clear than that? If so, I could solve this one.

@oscardssmith
Copy link
Member

looks good as is to me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs This change adds or pertains to documentation Hacktoberfest Good for Hacktoberfest participants
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants