Kotlin equivalent of JS function.apply or function.call


How I can invoke function and pass parameters as an Array object? Is there kotlin API? (Ok, js backend can doesn't support it, if need, I can implement it).


Currently, there's no API for that, but we could do something about it. We'll need to discuss the particular solution, though, because it may have subtle implications.


Opposite to java we can reference to function, so, the same approach as in JS is expected — any kotlin function should has method

{code}fun call(paramers:Array<Any>){code}

We don’t need equivalent of js function.call method (i.e. parametes as varargs) because “()” must be used in this case. We don’t need pass “this” reference, because it is not needed for callbacks, otherwise it is API related to reflection (not relevant for this topic).


This should be doable rather easily. Please, submit an issue to the tracker. Thanks


BTW, you can currently implement this manually by providing corresponding extensions. And this may even be the right way of implementing this functionality in the end.


How I can provide corresponding extensions? What is type for function? Do you mean TuplesAndFunctionsGenerator?


No, I meant providing the extensions neede manually.