[Feature Request] Add extend overload (mut other: Self)
Nobody has claimed this yet.
- Dominant language
- Mojo
- Stars
- 29.8k
- Forks
- 3.2k
- PR merge metrics
- No merged PRs in 30d
Description
Review Mojo's priorities
- I have read the roadmap and priorities and I believe this request falls within the priorities.
What is your request?
For reference: https://doc.rust-lang.org/stable/std/vec/struct.Vec.html#method.append
The overload would memmove like the var version, but not deallocate other but rather set its len to 0 and preserve the capacity.
Most of the existing infra could be shared in a private method.
What is your motivation for this change?
Reusing old allocations is a common optimzation known in Rust and C++.
Any other details?
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the existing var-form extend implementation and compare its behavior with Rust's Vec::append reference. Implement the mut other: Self overload so elements move, other is left with length 0, and its capacity is preserved; reuse the existing infrastructure where appropriate.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, rust
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100