A proposed of flatten modules function PR : <https...
# koin-contributors
a
A proposed of flatten modules function PR : https://github.com/InsertKoinIO/koin/pull/1801
đź‘€ 1
đź‘Ť 1
l
I'd suggest a check/attempt on
tailrec
flatten
is very well defined recursively, and adding extra allocations explicitly clutters the code and makes it less readable than the recursive version
I think maybe fixing the recursive version is possible instead of replacing it by an iterative one
m
That is very nice, thank you for the heads-up here Arnaudi! I did a review in the CL. 🙂
About using a recursive
tailrec
or a iterative approach, for such a simple self-contianed and “by the book” BFS, my opinion is that these implementation details are irrelevant; I would avoid entering the realm of bike-shedding here. Also, the fact we are basically rolling back to the original
flatten
implementation due to performance issues is a strong statement we don’t need to over complicate. Of course, we can always do improvements and change to another approach if the need appears.
a
Ok, let's keep the classic flatten by hand then 🙂
tailrec is overkill here