Use kotlin.time.Duration in the APIs

Instead of java.time.Duration, would be nice if you used kotlin.time.Duration in the APIs

1 Like

Hi Michael, thanks for the feedback!

This one’s bit tricky, since kotlin.time.Duration is still an experimental time API in Kotlin 1.5.21 with a scary admonition for library authors:

Note that this API is in a preview state and has a very high chance of being changed in the future. Do not use it if you develop a library since your library will become binary incompatible with the future versions of the standard library.

Since it’s still early days for the Couchbase Kotline SDK, breaking binary compatibility might not be the worst thing in the world. On the other hand I can imagine it causing problems.

What’s your perspective on the binary compatibility issue?

Since the Couchbase SDK only runs on the JVM at this point, would there be advantages to using the experimental kotlin.time.Duration?

Thanks,
David

yeah, not a good idea to ship a stable version of an artifact that depends on an experimental API.

Could ship a separate kotlin-experimental-time artifact with extension methods.

Binary compat is one of the most important things for any JVM lib.

Looks like kotlin.time.Duration was stabilized in Kotlin 1.6, so we can move ahead with this. Tracking as KCBC-46. This will be in 1.0.0-dp.5 planned for December 7.