Kotlin / KEEP

Kotlin Evolution and Enhancement Process
Apache License 2.0
3.42k stars 362 forks source link

kotlin.time.Instant #395

Open dkhalanskyjb opened 1 month ago

dkhalanskyjb commented 1 month ago

This issue is for discussing the proposed transfer of kotlinx.datetime.Instant to the standard library as kotlin.time.Instant. The full text of the proposal is here.

PR: https://github.com/Kotlin/KEEP/pull/387

hrach commented 1 month ago

Since "Implementation on the JVM" seems to be an open question and not fully answering this:

Is it the plan to copy the same implementation over as well? Wouldn't pure Kotlin implementation bring some benefits?

dkhalanskyjb commented 1 month ago

A pure Kotlin implementation would be somewhat easier to support, as we would not have to introduce workarounds for the discrepancies between the JVM implementation and ours. However, introducing our own implementation to the JVM could increase the bytecode size. In general, this is just an implementation detail. What is not an implementation detail but an observable behavior is whether kotlin.time.Instant can be passed to functions expecting a java.time.Instant (and vice versa) without any conversions. It's unclear how important this property is.

CLOVIS-AI commented 1 month ago

What is not an implementation detail but an observable behavior is whether kotlin.time.Instant can be passed to functions expecting a java.time.Instant (and vice versa) without any conversions. It's unclear how important this property is.

In my opinion, and from the codebases I have seen, this doesn't seem to be important as long as there is a .toKotlinInstant() (and back) extension.