I have just passed by something last day, and that was that when I was parsing some sqlite row on Android I faced a bit of a problem , where I was trying to instantiate an instance of a data holder class … So what an example of what I ended up with was like this
Dataholder(
(map["column1"] as Long).toInt(),
(map["column2"] as Long).toWhatever()
)
and it goes on and on …
So i thought why wouldn’t we make a small change so the syntax would be more like this
map["column1"]\Long\.toInt()
This would help getting rid of the parantheses which are a pain each time you forget them …
Adding new syntax to the language requires much stronger motivation than “I had this one task where I had to write this code which was a little bit verbose”. Casts are not that common in Kotlin code, and the syntax Kotlin has for them is much easier to read than the backslash operator (which is not used for type casts in any other language that I’m aware of).