Const generics where-restrictions?

Right. I think there's an under-explored design space here, of "How do we improve expressiveness and provide complex compile-time guarantees, while keeping post-monomorphization errors rare?"

I think there's a lot to learn from the D language on that front, which picked the "maximum-expressivity" side of the scale, such that avoiding post-monomorphization errors is the responsibility of library writers.

If I had the time, I'd be interested in making a survey of popular template libraries in D (especially variadic templates), the kind of idioms they allow, and how they could be implemented in Rust in a "monomorphization-resilient" way.

2 Likes