Description
It would be desirable to, at some point, grow the ability to abstract over the "mutability" of reference types. Currently, it is frequently the case that one must write separate "getter" methods for shared &
and unique &mut
references, even though the bodies of these methods are exactly the same. This is especially bothersome when those method bodies are nontrivial.
See an earlier discussion on reddit here.
Ideas for accomplishing this could potentially be borrowed from the research mentioned in this presentation, as well as from the Disciple language (a language with region types, effect types (e.g. mutation involving a region), and polymorphism over both).
This could also potentially allow the Fn
/FnMut
/FnOnce
, Deref
/DerefMut
, Index
/IndexMut
, and so forth hierarchies to be collapsed into single traits parameterized over capabilities / effects / constraints (whatever we choose to call them).