Re: [PHP-DEV] [RFC] Duration class

[email protected] (Morgan)
Newsgroups php.internals
Message-ID <[email protected]>
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?)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.