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

Clarify docs for LoadOrCompute and LoadOrTryCompute #154

Merged
merged 1 commit into from
Jan 27, 2025

Conversation

jjlin
Copy link
Contributor

@jjlin jjlin commented Jan 27, 2025

The existing docs seem to be derived from LoadOrStore, and reference what happens when a value is "stored". It would be clearer if the docs used consistent terminology and discussed what happens when a value is "computed".

The existing docs seem to be derived from `LoadOrStore`, and reference what
happens when a value is "stored". It would be clearer if the docs used
consistent terminology and discussed what happens when a value is "computed".
// and, if success, returns the computed value. The loaded result is true
// if the value was loaded, false if stored. If the compute attempt was
// cancelled, a nil will be returned.
// LoadOrCompute returns the existing value for the key if present.
Copy link
Contributor Author

@jjlin jjlin Jan 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also reordered LoadOrCompute and LoadOrTryCompute to make the order consistent between map.go and mapof.go. There are no actual code changes in this PR.

@puzpuzpuz puzpuzpuz added documentation Improvements or additions to documentation cleanup labels Jan 27, 2025
@puzpuzpuz
Copy link
Owner

Thanks for the contribution!

@puzpuzpuz puzpuzpuz merged commit 800e3a0 into puzpuzpuz:main Jan 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cleanup documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants