Array slices are extremely common in data manipulation code (see numpy/scipy in the Python world), so it may make sense to make it as easy as possible to use them in Kotlin as well.
I created a little bunch of extensions for slicing compatible with 1.0
Obviously it doesn’t fit for all use cases but simple enough for me to use in little pet projects
The key words in my reply are “as easy as possible”. In many cases, explicit syntax makes a feature easier to use than the application of a library feature.
Yes, special built-in syntax for common feature is good, but adding ad-hoc syntax for list and array slicing only seems as overkill
For example: You can provide a new operators:
Really? I thought that was the main selling point which convinced me to switch to Kotlin. Not only was sold several times in multiple talks esp. comparing it with Java but also the kotlin website has it as the first selling point under the “Why Kotlin?” section: “Concise”. I’m confident that generally means lesser code. Also, I don’t think the ternary operator would conflict with kotlin’s existing language features–it would enhance it as ternary operator looks a lot like some of the operators kotlin already has.