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

Add sliceToArray() in Array and VarArray #126

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open

Conversation

rvanasa
Copy link
Collaborator

@rvanasa rvanasa commented Jan 31, 2025

Follow-up PR to address this comment on #119.

The naming depends on whether we eventually want to include a slice() function which returns a view (rather than copy) of the original array. If not, another design consideration is whether we want VarArray.slice() to return [T] or [var T]. This is the reasoning for the current name (sliceToArray()), which would give us the flexibility to also include VarArray.sliceToVarArray<T>(...) : [var T] in the future.

We could maybe also rename Array.range() to Array.sliceToIter() to follow this convention (perhaps slightly better for LLMs).

@rvanasa rvanasa requested a review from a team as a code owner January 31, 2025 20:43
Copy link

github-actions bot commented Jan 31, 2025

✨ Documentation preview for 9b5ebc9:

https://dfinity.github.io/new-motoko-base/pull/126 (source code)

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.

1 participant