I see a slight inconsistency in the Kotlin syntax: for normal functions, if the last parameter is a lambda, you can omit the parentheses. But this is not the case for constructor parameters; hence we need the parentheses around the curly braces.
j
Joffrey
01/22/2024, 9:21 AM
Yeah that's why I tend to avoid constructors with a single lambda. Usually a top-level function is fine
k
Klitos Kyriacou
01/22/2024, 9:23 AM
I tend to avoid constructors with a single lambda
Kotest is absolutely full of them!
j
Joffrey
01/22/2024, 11:22 AM
Let me clarify: constructors of open classes (the ones that can potentially be used in a subclass declaration)