https://kotlinlang.org logo
g

groostav

08/11/2016, 1:02 AM
So I just got burned by a funny bug involving some java code that is similar to
map
in principal: The problem was that I was assumgng eager evaluation and my implementation was lazy. Now from java that's fine, since if you had written the code I just wrote, java would complain with "expected lambda param A -> T, but found A -> void". Because of type inference, Kotlin let T == Unit, and everything compiled just fine, and was effectively a no-op.