Luke
07/17/2019, 8:53 PMShawn
07/17/2019, 8:57 PMRuckus
07/17/2019, 9:04 PMinvoke
operator.
fun test(op: Thing.() ->) {
op // Does this reference the value, or invoke the lambda?
}
streetsofboston
07/17/2019, 9:05 PMoperator fun Type1.invoke(block: () -> Type2) : Type3
🙂fun test(op: Thing.() -> Unit) {
op // Does this reference the value, or invoke the lambda?
}
the op
refers to the lambda value; you don’t invoke it. someThing.op()
invokes it.Luke
07/18/2019, 1:39 AMfun foo() {...}
, you could write fun foo {...}
. I don’t see a confusion or ambiguity herestreetsofboston
07/18/2019, 3:21 AMfun
keyword, it won't be ambiguous.
But somehow it looks odd/off to me....Luke
07/18/2019, 1:30 PM