Going further: I would like to have an attribute that declares a trait to be dyn-capable. Something like:
#[dyn_capable]
trait Foo { ... }
It would then be a compilation error if that is not the case. We would lint (warn) if you do dyn Foo
and Foo
is not declared as dyn_capable
.
The purpose of dyn_capable
is then to declare your intention that Foo
should be usable as an object, which implies accepting limitations on its design.