I'm working with KotlinPoet and I'm wondering if a...
# squarelibraries
v
I'm working with KotlinPoet and I'm wondering if a lambda with receiver was ever considered to make
beginControlFlow()
/
endControlFlow()
chains more readable?
Copy code
.controlFlow(".let") {
    add("%T.fromNativeValue(it)", returnTypeInfo.kotlinTypeName)
}
Although the trailing lambda will interfere with the varargs arguments and would need some additional wrapping in a function or
CodeBlock.Builder
z
it's trivial to write your own extension
kotlinpoet focuses on making the building blocks good
v
yes indeed, and that might be what we're doing. I was just wondering if that was considered, and if there are maybe reasons why I shouldn't.
e
Trailing lambdas can come after varargs, that's not necessarily an issue