Project
core
Describe the feature
Maybe this is tricky in terms of the type system, but I think it would be great to able to do
let a: [u8; 4] = [0, 17, 255, 23];
let b: u8 = a[3];
and similar. Right now you have to actually destructure the whole array in order to get individual values. For example, p2ms.simf does
let [pk1, pk2, pk3]: [Pubkey; 3] = pks;
let [sig1, sig2, sig3]: [Option<Signature>; 3] = maybe_sigs;
and you can't conveniently refer to the value at position i at all. I don't think there is an architectural reason that this is meant to be prohibited.
(Among other things, this means that it's hard-to-impossible to loop over an array with for_while, although you can differently loop over an array with array_fold.)
Project
core
Describe the feature
Maybe this is tricky in terms of the type system, but I think it would be great to able to do
and similar. Right now you have to actually destructure the whole array in order to get individual values. For example,
p2ms.simfdoesand you can't conveniently refer to the value at position
iat all. I don't think there is an architectural reason that this is meant to be prohibited.(Among other things, this means that it's hard-to-impossible to loop over an array with
for_while, although you can differently loop over an array witharray_fold.)