Hi all,
The LSG is accepting this proposal in principle, but is inclined to change the proposed type names based on discussion here. We want to leave a little more time for feedback about the naming before finalizing it.
The LSG intends to change the names of these types to Ref and MutableRef, respectively. There are a number of factors that went into this change:
Refbetter matches the way we are talking about these as "references", and we found that trying to explain them as "borrows" (which is odd as a known) or "borrow types" (which is odd in our value-centric lifetime system) was awkward.- LSG feels that the conceptual overlap with "reference types" (like classes) is generally a helpful association. Reference types are referenced, not copied. You can create a
Ref<T>to store a (conceptual) reference to aT. The fact that there's an optimization where we copy small values rather than store them indirectly doesn't invalidate that the type operates like a reference; it's just an implementation detail. - These follow the
MutableXYZpattern that is well-established in the standard library. That pattern does not work as well with other alternatives discussed (likeBorrow, where "mutable borrow" is a phrase we've been trying to avoid). - We could spell out
RefasReferenceinstead, but this is much longer (especially forMutableReference), and fundamental types in the standard library do often have shorthand names (Int,Bool, etc.).
We'd love to hear your thoughts on this direction.
Doug, Review Manager