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

newSeqUninitialized over-constrained, setLenUninitialized missing #19727

Closed
arnetheduck opened this issue Apr 15, 2022 · 1 comment
Closed

newSeqUninitialized over-constrained, setLenUninitialized missing #19727

arnetheduck opened this issue Apr 15, 2022 · 1 comment
Assignees

Comments

@arnetheduck
Copy link
Contributor

newSeqUninitialized allows creating seq:s that are not initialized, for use as general-purpose buffers.

It is however constrained to SomeNumber, which is unnecessarily restrictive: any type composed only of "trivial" types qualifies for this kind of treatment, similar to how copyMem is constrained to types that supportsCopyMem.

The above functionality is needed to create efficient serializers that preallocate memory then fill it with data from a source (disk/network/etc).

Growing a sequence uninitialized is needed likewise to reuse memory buffers in the above serializers - they do not have access to the capacity of the seq, so there is no way to write an optimal deserializer that reuses the existing capacity of a seq.

@Araq Araq added the Status label Apr 17, 2022
@ringabout ringabout self-assigned this Aug 28, 2023
ringabout added a commit that referenced this issue Sep 28, 2023
Araq pushed a commit that referenced this issue Sep 28, 2023
Araq pushed a commit that referenced this issue Sep 29, 2023
ref #19727
closes #22586

#22554 needs it to move on.
`newSeqUnsafe` can be introduced later.
@ringabout
Copy link
Member

ringabout commented Sep 29, 2023

fixed by #22739 and #22767

narimiran pushed a commit that referenced this issue Apr 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants