Skip to content

[RFC]: add @stdlib/array/empty #982

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

Closed
3 tasks done
kgryte opened this issue Mar 24, 2023 · 0 comments · Fixed by #983
Closed
3 tasks done

[RFC]: add @stdlib/array/empty #982

kgryte opened this issue Mar 24, 2023 · 0 comments · Fixed by #983
Assignees
Labels
Feature Issue or pull request for adding a new feature. RFC Request for comments. Feature requests and proposed changes.

Comments

@kgryte
Copy link
Member

kgryte commented Mar 24, 2023

Description

This RFC proposes adding a package to return an array having uninitialized memory.

The API should be similar to @stdlib/array/ones.

For non-generic dtypes, we can use @stdlib/buffer/alloc-unsafe and the reinterpret the underlying ArrayBuffer. If Buffer is not a Uint8Array (i.e., Node.js <3.0.0), we should use @stdlib/array/zeros. The Uint8Array check can be part of a polyfill.

In browser environments, memory should be zero-filled, as returning uninitialized memory is not possible.

For generic dtype, we should return a zero-filled array.

Related Issues

None.

Questions

No.

Other

No.

Checklist

  • I have read and understood the Code of Conduct.
  • Searched for existing issues and pull requests.
  • The issue name begins with RFC:.
@kgryte kgryte added RFC Request for comments. Feature requests and proposed changes. Feature Issue or pull request for adding a new feature. labels Mar 24, 2023
steff456 added a commit that referenced this issue Mar 24, 2023
@steff456 steff456 mentioned this issue Mar 24, 2023
1 task
kgryte added a commit that referenced this issue Mar 24, 2023
PR-URL: #983
Closes: #982
Co-authored-by: Athan Reines <[email protected]>
Reviewed-by: Athan Reines <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Issue or pull request for adding a new feature. RFC Request for comments. Feature requests and proposed changes.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants