Re: [RFC] Duration class
| From: | Morgan | Date: | Fri, 03 Jul 2026 01:23:22 +0000 |
| Subject: | Re: [RFC] Duration class | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-131726@lists.php.net to get a copy of this message | ||
On 2026-07-03 03:27, Tim Düsterhus wrote:
Any suggestions regarding naming from your side? Best regards Tim Düsterhus"translate" would be too abstract, obviously. Have "offset" or "shift" been suggested? "offset" is also a noun so would need to be "offsetBy" or "withOffset"; the former is still a bit ambiguous, and while the latter I think clearly returns a new Duration, it suggests there's some kind of distinct "Offset" entity. "shift"/"shifted" - perhaps with a "By" to make reading flow more naturally - gets the translation idea across I think: we're moving an Instant from _here_ to _there_ by _this_ amount. Larry has already commented on the connotations of the "-ed" suffix: the former is active, the latter is passive; one changes the object it's applied to, the other returns a new one. (If there's any debate on that, my preference would be for immutable objects: having an object _here_ change because of something done to it over _there_ ... such communication should be done out in the open and not hidden inside arbitrary values.) (And that active/passive tension is often a thing in coordinate transforms - are we changing the object and seeing the results in our reference frame, or are we changing our reference frame and just changing our description of the object?)