rsocket-kotlin icon indicating copy to clipboard operation
rsocket-kotlin copied to clipboard

Use Paytload{} instead of buildPayload{}

Open SPC-code opened this issue 1 year ago • 0 comments

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.

SPC-code avatar Oct 12 '24 13:10 SPC-code