What is the choosing guide between `T.() -> R` ...
# dsl
u
What is the choosing guide between
T.() -> R
and
(T) -> R
for function type? First one called lambda with receiver and second one is the first class function.
w
its kind of the same logic as
run
vs
let
s
Its obviously subjective but whatever works best for the caller. ie. in
kotlinx.html
its
T.() -> R
because
T
is more of a context (ie. its kind of optional to use it so its annoying to shadow another
it
) whereas for
forEach {}
its more of a parameter since it doesnt make sense to call
forEach()
without actually using it.