Unsigned number arrays functions (eg. chunked) don't match signed funs

re 1.3.30 and “Standard library: operations for unsigned number arrays”

It was surprising that I can do UIntArray(width * height).chunked...
But when I try to do the same without the “U” (IntArray(width * height).chunked...) it isn’t supported.

FR: Support the same functions across TypeArrays as is supported with UnsignedTypeArrays.

UIntArray is an inline class inheriting collection, so the chunked method you see is an extension of collection, not the array itself. The separate type of array, which does not inherit either collection or even iterable is a pain, but it is one of those things we need to pay for Java compatibility.

Could IntArray have an extension function ‘chunked’ that brought it into alignment?

It was just… odd… to see two different typed arrays have such different capabilities. I “least astonished” assumed that all typed arrays were pretty much the same.

I guess, the kotlin team would love to extend IntArray from Collection as well, but this is sadly not possible due to the underlying jvm-type. It’s annoying in a few situations but can’t really be changed AFAIK.
But I guess if you create an issue here there is a good chance that the other typed arrays get extended.

Issue created, thanks! https://youtrack.jetbrains.com/issue/KT-31304

In fact, it is not so impossible as it seems. One could create an inline class not unlike UIntArray on top of primitive and typed arrays and extend a List. What one needs is a compiler intrinsic that will replace result type by primitive in those cases when the type of array is explicitly known. I’ve written a feature request about it some time ago. It probably could be done.