is there a reason why Array does not implement Ite...
# getting-started
b
is there a reason why Array does not implement Iterable? Java compat?
1
j
I'm not sure why, it might very well be due to Java interop. But arrays are not used much in Kotlin anyway, except in low level data structure implementations. In general, we tend to prefer lists.
b
right, I'm looking at Kotlin JS which definitely has more Array usage
also going through the source, it seems map for instance is implemented multiple times
so defining extension functions in general seems to be lots of boilerplate
j
The usual extensions on collections/iterable are indeed defined separately for arrays because of this. In the standard library, I believe those extensions are generated. But yeah it makes it slightly more cumbersome if you need to define custom extensions on arrays. That said, even in Kotlin/JS I still used mostly lists except for specific interactions with some JS APIs.
a
🙌 1
b
thank you, I think I can work with that 🙂
a
np!
there's also the kotlin-wrappers projects, that provides helpers for JS, but I have no idea if it could help you with Arrays E.g. I see there's a JsArray https://github.com/JetBrains/kotlin-wrappers/blob/pre.792/kotlin-js/src/jsMain/kotlin/js/array/JsArray.kt
b
I interop a lot with JS APIs so going with Lists just ends in a lot of converting back and forth
there are some benefits of lists with regards to equality I think