So, after reading some other posts, articles, and tutorials mainly about these types: (1) &T
, (2) &mut T
, (3) mut & T
, and (4) mut &mut T
. I am a bit confused about the naming, especially for the first two.
Most if not all resources use the term "immutable reference" and "mutable reference" for the first and the second respectively. Now from my understanding of the English language (I'm not a native speaker) the correct terms would be more along the following:
(1): "immutable reference" (implying immutability of T
)
(2): "immutable reference to mutable value"
(3): "mutable reference" (actually being able tu mutate the reference itself, again implying immutability of T
)
(4): "mutable reference to mutable value"
When always assuming immutability, (1) and (2) could also be shortened by dropping the "immutable" parts.
Now my guess would be either, the naming has historically grown to be what it is ("mutable reference" is obviously more ergonomic than "immutable reference to mutable value" given that (2) is much more common than (3), but from my understanding the first is just wrong for what it is used), or my understanding of the language is wrong?
I'm not proposing that we should change any text's out there, but just for the sake of my understanding
Thanks in advance