> For example, there are no implicit widening c...
# getting-started
c
d
chuck: Because their behavior is frequently unexpected, and as a rule Kotlin doesn’t perform implicit conversions between types.
http://www.javapuzzlers.com/java-puzzlers-sampler.pdf puzzle 1 has an example of a widening conversion creating “unexpected” behavior.
👍 1
p
I kinda miss this too. I guess I would forgive some unexpected behvavior in few edge cases for not having to write
toInt()
or
toDouble()
fifty times in one file when working with any sort of math or graphics library.
d
I agree it can be annoying, although I find that being able to define
val Byte.i: Int get() = this.toInt() and 0xFF
does a pretty good job of compensating for the shortcoming (when working with Bytes, for example).