Re: [RFC] Duration class

From: Date: Thu, 02 Jul 2026 01:53:48 +0000
Subject: Re: [RFC] Duration class
References: 1 2 3 4 5 6 7 8 9  Groups: php.internals 
Request: Send a blank email to internals+get-131693@lists.php.net to get a copy of this message
On 2026-07-02 05:22, Tim Düsterhus wrote:
To close this out ourselves: While having a static sum() method works for Durations, since the Duration with addition forms an abelian group, this doesn't work for the other future-scope classes where addition doesn't form an (abelian) group. More specifically: Adding two Instants together is not a meaningful operation. Adding a Duration to an Instant however is. If you want the appropriate mathematical structure, the timeline models a one-dimensional real affine space, in which Durations are vectors and Instants are points; it's a vector space that has forgotten its origin (the choice of epoch is arbitrary and not a distinguished point of the space - as evidenced by how many of them there are).


« previous php.internals (#131693) next »