I wanna say no but why allow this in a constructor...
# announcements
a
I wanna say no but why allow this in a constructor parameter?
n
a
ah!!! you're the best. Thank you so much!
n
Lol, np
a
second reaction - lol that's crazy
I really didn't think this sort of thing is allowed and now I'm about to abuse the hell out of this 😈
i
Btw,
compareBy
is a function taking a vararg of functions: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.comparisons/compare-by.html
a
@Nate but can a
vararg
only be referenced within an
init
block?
@ilya.gorbunov Interesting, I'll have to see how that's implemented. this is definitely a rabbit hole worth diving into!
n
you can declare it as
vararg val functions
to be able to use it elsewhere
a
oh my, I was mixing up the order! thanks!
Also, I looked into the comparator functions.... I wish I could write something as elegant and beautiful. With more time I can!
p
It is just syntactic sugar around Array<(String) -> String>