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

slice: deprecate Dedup, shim to the equivalent stdlib slices.Compact #16

Merged
merged 1 commit into from
Jul 25, 2024

Conversation

danderson
Copy link
Collaborator

There is a slight semantic change: elements beyond the end of the compacted slice are zeroed in slices.Compact. While this is a semantic change, it should be a strict improvement since people don't generally intend to hide old values (and pin pointers, from the GC's POV) in the unused part of a backing array.


Random proposal, while I was in the area. WDYT?

Copy link
Owner

@creachadair creachadair left a comment

Choose a reason for hiding this comment

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

SGTM. I originally wanted to avoid dependencies on x/exp/slices, since they couldn't seem to keep the API stable, but now that slices in the real standard library this is quite unnecessary.

slice/slice.go Show resolved Hide resolved
@danderson danderson force-pushed the push-qrwwmlwnvlsz branch 2 times, most recently from 0e774cf to 9a22284 Compare July 25, 2024 23:42
Copy link
Owner

@creachadair creachadair left a comment

Choose a reason for hiding this comment

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

Thanks!

slice/slice.go Outdated Show resolved Hide resolved
There is a slight semantic change: elements beyond the end of the compacted
slice are zeroed in slices.Compact. While this is a semantic change, it should
be a strict improvement since people don't generally intend to hide old values
(and pin pointers, from the GC's POV) in the unused part of a backing array.
@danderson danderson force-pushed the push-qrwwmlwnvlsz branch from 9a22284 to 5502bda Compare July 25, 2024 23:44
@danderson danderson merged commit d711d76 into creachadair:main Jul 25, 2024
1 check passed
@danderson danderson deleted the push-qrwwmlwnvlsz branch July 25, 2024 23:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants