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

proposal: typesafe sync.Map - affected/package: /x/sync #52085

Closed
kf6nux opened this issue Mar 31, 2022 · 2 comments
Closed

proposal: typesafe sync.Map - affected/package: /x/sync #52085

kf6nux opened this issue Mar 31, 2022 · 2 comments

Comments

@kf6nux
Copy link

kf6nux commented Mar 31, 2022

Background

sync.Map was useful enough to be promoted from /x/, but was made before generics and utilizes interface{} (now any)

Proposal

Re-implement the existing API of sync.Map using generics for added type safety/convenience. Use alternate struct name to maintain backward compatibility (e.g. sync.MapGeneric)

Release

Release to /x/sync first while feedback is submitted.

Additional considerations

Proposal #47643 requested support for additional algorithms for additional use cases. We may want to allow the sync.Map's implementation algorithm to be user selectable. If so, I'd propose adding a method that can optionally be invoked on newly created sync.MapGeneric structs to specify the backing algorithm.

Separately

I volunteer to do the work.

@gopherbot gopherbot added this to the Proposal milestone Mar 31, 2022
@kf6nux
Copy link
Author

kf6nux commented Mar 31, 2022

Ah, I was just informed this is also being discussed here #48287

@ianlancetaylor
Copy link
Member

Thanks. See also #47657. Closing as dup.

@golang golang locked and limited conversation to collaborators Mar 31, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants