3 ms·
Looks neat. Any notes on const generics e.g.`Array[T, N]`?
by Ygg2 9y ago
Looks neat.
Any notes on const generics e.g.`Array[T, N]`?
- kibwen 9y agoThe tracking issue for const generics is here: https://github.com/rust-lang/rust/issues/44580 https://github.com/rust-lang/rust/issues/44580
- the_mitsuhiko 9y agoOne of the biggest issues with looking at tracking issues for me is that it's impossible to judge either priority or complexity. This one for instance is a good one. Tags say implemented and approved, the checklist is mostly docs. Yet it looks like from the discussion that this issue is closer to not landing at all in this form than landing.
- kibwen 9y agoAs with many large features, people with their heads down will be working on it for a long time without much fanfare, until suddenly the feature appears in a mostly-usable state shortly before it is able to be stabilized. Not much solace for the people who want to be able to predict when features will land, though the tracking issue should at least give some idea as to which developers are prioritizing this so that one can contact them directly for more information.
- Ygg2 9y agoAs far I understand the RFC won't allow for `Array[Y, N]` (or `Array<T, N>` in Rust parlance) note eddyb's comment: Note that all of this should allow impl<T, const N: usize> Trait for [T; N] {...}, but not actually passing a constant expression to a type/function, e.g. ArrayVec<T, 3>. What I'm actually looking is `Array<Y, size_of::<T>>` for support for data structures that vary depending on size of `T`.
- tatterdemalion 9y agoThe RFC supports it, eddyb's list of milestones in the compiler just don't get you all the way there.
- steveklabnik 9y agoThe design of const generics is fine, but there's underlying technical work in the compiler to be done. We expect const generics to land in nightly this year, but they're unlikely to make it to stable before 2019.