https://kotlinlang.org logo
Title
p

pavel

02/13/2019, 11:58 PM
which, of course, works
g

ghedeon

02/14/2019, 12:08 AM
in theory, if your function is tailrec than it's compiled into a loop and could be inlined. But I'm afraid the inline tailrec is not supported yet.
s

SOFe

02/14/2019, 2:18 PM
@pavel you might be interested in this new answer by me: https://stackoverflow.com/a/54692556/3990767
It does not require tail recursion, but suffers from creation of anonymous classes
I personally consider it as a bad practice to declare an anonymous class inside an inline function though
but this is where you need it
hmm, looking at it again, maybe it's more or less the same as the first answer's first method
p

pavel

02/14/2019, 5:47 PM
Yeah, it’s more or less the same. I went with something similar. It’s not aesthetically pleasing, but it works