Functions like buildList were frequently used at the beginning of Kotlin, but it seems like nowadays it is much better to use fake constructors instead of top-level functions. So, I suggest adding a Payload{ } builder and deprecate buildPayload without changing its desgin.
Motivation
The only motivation for this change is discoverability. If you want to create Payload, you start typing Payload without looking into documentation for function. It is not possible to do that for List in the standard library because it would be ambiguous now, but for Payload it seems to be a good solution.
Functions like
buildList
were frequently used at the beginning of Kotlin, but it seems like nowadays it is much better to use fake constructors instead of top-level functions. So, I suggest adding aPayload{ }
builder and deprecatebuildPayload
without changing its desgin.Motivation
The only motivation for this change is discoverability. If you want to create Payload, you start typing Payload without looking into documentation for function. It is not possible to do that for
List
in the standard library because it would be ambiguous now, but forPayload
it seems to be a good solution.