Sajal
01/16/2023, 2:29 PMsomeLambda
, where the lambda must take in a Contract.()
and return nothing (Unit
). But what does Contract.()
mean? Are we dot-accessing something on an interface?ephemient
01/16/2023, 2:32 PMFunction types can optionally have an additional receiver type, which is specified before the dot in the notation
Sajal
01/16/2023, 2:52 PMTung97 Hl
01/17/2023, 3:31 AMephemient
01/17/2023, 3:39 AMval someLambda: (Contract) -> Unit = { ... }
someMethod(someLambda)
will compile and run just fine. what it does do, though, is make it so that when you write a lambda right there, it is inferred to have a receiver of type `Contract`:
someMethod {
this is Contract
}
Tung97 Hl
01/17/2023, 4:06 AM