Hey guys! I'd like to discuss the following syntax...
# codereview
Hey guys! I'd like to discuss the following syntaxes:
Copy code
fun insertAll(uses: Iterable<Use>) {
  uses.forEach { insert(it) }
What do you think about both approaches?
I strongly prefer the first, because it's clearer (or even necessary) in case of overloads
note that due to various reasons, the two don't compile to the same code in the non-inline case:
{ insert(it) } != { insert(it) }
which makes it easy for the compiler to create a wrapper, but
::insert == ::insert
which means the compiler has to do some more work to produce a stable reference
👍 1
also the former can be compiled to modern indy lambdas but the latter cannot be for historical compatibility reasons (related to the above), https://youtrack.jetbrains.com/issue/KT-45658
👍 1