I thought I’d start discussion here before writing up a full-blown RFC, in case my brain is at fault.
As the title suggests, I’d like to propose we change the name of RefCell to be more descriptive.
First a summary of RefCell:
- It provides interior mutability: objects inside can be mutated through an immutable reference. This is safe because:
- It does borrow checking at run-time.
Now let’s do an analysis of the current name:
- Ref: short for reference. Most likely refers to the run-time-checked references that the RefCell provides.
- Cell: refers to the Cell type which supports interior mutability for Copy types. The term is probably used here to connote the “interior mutability” property, rather than the Cell type itself. I’m not sure if the term “Cell” has a precedent outside of Rust.
I feel the current name is kind of poor, as you can see from the complexity of the analysis. If there’s a shorter explanation that I’m missing, please enlighten me. Up until recently, I’ve actually had to keep re-learning what the RefCell type actually does because I haven’t found a need for it yet and its name doesn’t describe its purpose very well. It’s been very much a case of “which one is that again?”.
Here are a few proposals for a new name:
- RunCheck<T> / RunChecked<T>
- DynamicCheck<T>
- Dynamic<T>
My personal preference is RunChecked<T>. So what do you guys think? Is a name change a reasonable proposal? What name do you like best? Answer below!