hi, i have stumbled upon this unfortunately blocked thread, and felt like bringing it back up since the discussion seemed to be going somewhere, and i feel like the proposal is a very nice way to make some implementations (for example, the IxDyn type in ndarray) way simpler.
as stated in the thread itself, this would make for a straightforward way to define dynamically sized types, using a syntax similar to the one already in use for dynamic dispatch.
I'm still quite fond of “dyn const” as a pathway to (a very useful subset of) custom DST. Unfortunately, you can do things with const parameters which fundamentally can't be erased, e.g. consider
struct Const<const N: usize>;
impl Tricky for Const<0> {
type Type: Trait;
}
struct Weird<const N: usize>
where
Const<N>: Tricky,
{
inner: <Const<N> as Tricky>::Type,
}
With this or other similar kinds of formulations, &dyn<const N: usize> Weird<N> can't work with just N: usize as pointer metadata, because it takes more than just turning a const computation into a dynamic one to financially manipulate Weird<N>. So at a minimum, there needs to be some kind of further restricted const context that enables the const generic to be erased as such.
Ultimately, there are a lot of open feature ideas, and a lot of accepted extensions to the language which still aren't implemented. And the most common case of a single one-dimemsional slice is handled well enough by making the array an unsizable generic that generalizing slice length erasure is just low priority compared to other work items.