is there a way to generate a giant when clause - g...
# stdlib
a
is there a way to generate a giant when clause - given a List of predicates?
d
At runtime?
a
either is fine
d
You can use kotlinpoet to generate the source code from the List.
a
no no I dont want code gen like that
d
Oh. I guess you can just loop through the predicates at runtime and call them?
d
It would be interesting to have some sort of
inline list
feature that let you automatically unroll a loop over a set of elements, like
inlineList(a, b, c).forEach { println(it) }
that compiled to
println(a); println(b); println(c)
j
enum is compact at bundling predicate dispatch