(aka Hiding representation details from concrete types or ideas themselves)
Hi, I appreciate the current design, which explicitly exhibits the ingredients and components (like Rc, Box, RefCell, etc) within concrete types, which is very good.
However, i think that in more complex systems, there shall be some ergonomic way to hide these details from the “concepts” for some domain objects. Shareable and Mutable should be its property, but other than that, whether there’s Arc or Mutex behind those ideas should be hidden some way.
For example, When we implement Deref<T>
for Rc<T>
we’re actually providing them a way to access the inner data, i.e. operate through the “eggshell”. However, when there’s more than one level of “eggshell”, things become worse…
For example, it’s currently quite frustrating to argue about Arc<Mutex<T>>
or Weak<Trait>
in the codes. Especially in the later case, where we’re struggling to hide what it is with trait objects but still leave its shareable state hanging outside…
I wonder if people’re feeling the same.