Monomorphism as an optimization?

Having recently read @brson's blog about compile times, which made the point that it's not inherently true that monomorphization is an optimization, I'm wondering whether there should be something in between impl Trait and dyn Trait that allows the compiler to choose how to compile it, possibly based on compiler flags. I understand in cases where inlining happens this occurs anyhow, but am wondering if (like inlining) this should be a decision that the compiler makes rather than the developer? Thoughts?

Some relevant discussions:

1 Like

Thanks, those were interesting reads! I hadn't thought through the complication of associated types and constants, and what that would do to a dynamic implementation.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.