rust-lang / rust-lang/rfcs

Rc/Arc needs a better name than `clone`

Open
#2,588 17 comments 45 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

T-libs
Dominant language
Markdown
Stars
6.6k
Forks
1.7k
Avg merge
16h 14m
Merged PRs (30d)
1

Description

Seeing clone all over the codebases makes me cringe with no way to know if it's an expensive one or if it's just a reference increment. One has to dig back all the way to type to understand what it actually means.

Would it not make more sense to have a method like ref or similar that can be used instead of clone ? So, that's its explicit and clear. The ref method could just as well call clone internally. Or perhaps, new_ref. Or a name that makes more sense. Just not clone, (though that has become accepted today in the ecosystem) but the actual semantics are rather different.

Edit: Make it clear that I'm not suggesting that clone be renamed - That's neither my intent nor a solution to the issue. Just looking for potential way to mitigate this.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No implementation file, test, or entry point is named. Start by reading the issue discussion and the linked RFC repository context, then evaluate the proposed alternatives for making reference-count increments clearer than clone; done means reaching agreement on a concrete naming or API direction.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.