@oli , regarding your comment on rust-lang/rfcs#2545, what is the strategy there for allowing operations like deriving Debug or even indexing just into the Array? I tried playing with the code and found that attempting to add
Index impls hit errors about "trait
Array cannot be made into an object" due to its use of an associated const.
Debug works out of the box by adding it as a bound to
Array's definition, but unfortunately almost all other common operations are implemented indirectly via
Unsize, so every use site would need
&FOO as &[T], which makes my idea unactionable. We'd need some language/compiler magic that would make
impl Unsize<T> also allow operations via the unsizing (and as a consequence, also allow
U: Unsize<[T]> bounds on generic functions to allow indexing into values of type
U. I wonder if we'd get these automatically by implementing
Deref for all array types up to length 32.
Hmm I thought I tried adding
Debug as a bound and found it did not work
can one make it a bound that is conditional on whether
T: Debug ?
Ah no, probably not.
okay. so basically, the idea doesn't work on any front. :smile: