Currently there is no standard library function to concatenate two strings in a type-safe way.
String.plus operator accepts
Any? (like Java) performing an implicit conversion to string (in my opinion dangerous), moreover there’s not any function like Java
So I would suggest to restrict the
plus operator or, at least, provide a function in standard library like the following:
infix fun String.concat(other: String): String = this + other
Note: I’m experimenting the latest Kotlin 1.1 version.