I'm reading some ECMA-335 text today, which is about the design of dotnet CLI. There's something called typed reference there, which consist of static data type and the address of data, which reminds me of the trait objects in rust.
So, in rust, one way to think about the trait objects is: it's actually a more generic type constrained by const generics, taking some metadata matching a trait as the constant, and the resulting type automatically implements the trait.
And by removing the constant bound, maybe there can be a
dynany type. Its relationship to
dyn Trait is just like
&[T; 3]. Using a
AsRef/AsMut, the Trait part of
&dyn Trait can be erased, transformed into a
&dynany type, and by specifying the metadata for some trait as constant generics,
In this idea,
Box<dynany> can supply uniform storage for every value, and
&dynany can supply uniform storage for shared pointers.