So why does Kotlin sometimes offer the bracket syn...
# announcements
s
So why does Kotlin sometimes offer the bracket syntax for a java method over providing a parameter directly? i.e. there is a Java function:
void someFun(SomeParam someParam)
but when I use Kotlin, I can see 2 versions of that function: 1. Exactly like Java. Function takes a param of type
SomeParam
2. Another function that takes a function that returns
SomeParam
The second supported call type doesn't behave the same way as the first. I actually don't know what it does. Sometimes I accidentally use the second approach without realizing it, and I end up with code that just stops and doesn't execute. It's very annoying diagnosing this (I wasted 2 hours last night). What is the second approach for, and why doesn't it work the way I'd expect?