
Description
std.BoundedArray
seems to be the only exception in the standard library that has an extra function constSlice()
as an alternative to slice()
to return a constant slice []const Type
instead of []Type
instead.
My proposal is to remove constSlice()
and rename slice()
to items()
to be more similar to the other list types, such as the items
field of std.ArrayList
or the items()
function of std.MultiArrayList
. If std.BoundedArray
has both of those why don't std.ArrayList
and std.MultiArrayList
etc. additionally have constItems
or constSlice
?
I suppose the pattern is that you're supposed to use constSlice
wherever possible and slice
only if needed to prevent accidental mutations. But I think the language already does enough here that this is not really needed? At least I've never been bitten with just using slice()
everywhere.