In support of Instant.minus(Instant)
Stephen Colebourne
scolebourne at joda.org
Thu May 2 17:04:20 UTC 2024
On Thu, 2 May 2024 at 15:58, Kurt Alfred Kluever <kak at google.com> wrote:
> instant − instant = duration // what we're discussing
> instant + duration = instant // satisfied by instant.plus(duration)
> instant - duration = instant // satisfied by instant.minus(duration)
> duration + duration = duration // satisfied by duration.plus(duration)
> duration - duration = duration // satisfied by duration.minus(duration)
> duration × real number = duration // satisfied by duration.multipliedBy(long)
> duration ÷ real number = duration // satisfied by duration.dividedBy(long)
>
> All but the first operation have very clear translations from conceptual model to code. I'm hoping we can achieve the same clarity for instant - instant by using the obvious name: instant.minus(instant)
But you can't have
instant + instant = ???
It doesn't make sense.
This is at the heart of why minus isn't right in this case.
Stephen
More information about the core-libs-dev
mailing list