elect
05/20/2020, 9:11 AMclass Function1<A : Number, R : Number>(val func: (a: A) -> R) {
operator fun invoke(a: A): R = func(a)
}
why ::invoke
seems to require a parameter of type Nothing
here:
when(val f = t.function) {
is Function1<*, *> -> f.invoke(stack.pop()) // Type mismatch: required Nothing
}
Because of the <*, *>
? I cant specify anything else because of type erasure
this works though
is Function1<*, *> -> (f as Function1<Number, Number>)(stack.pop())
Michael de Kaste
05/20/2020, 9:43 AMelect
05/20/2020, 9:49 AMf
lambda