Re: [RFC] Duration class
| From: | Tim Düsterhus | Date: | Fri, 17 Jul 2026 15:20:46 +0000 |
| Subject: | Re: [RFC] Duration class | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-131996@lists.php.net to get a copy of this message | ||
Hi
On 7/17/26 16:01, Holly Schilling wrote:
If we can get Structs and Duration to both land in PHP 9, I’d love to see Duration benefit from them.I do not consider it a good idea to delay improvements to PHP’s standard library to wait for something that has not even left the Draft phase and thus will take an unknown *duration* to land - if it ever happens. I believe that improvements to the standard library are the single most impactful thing we can do to improve PHP and we’ve done a great job in the recent versions in doing so (e.g. with the new URI extension). Value-based structs also do not bring significant improvements over what we can already do with
final and readonly classes. In fact, it would likely be possible to just convert final readonly classes to value-based structs with only very minor breaking changes if there is a desire to do so.
It's also unclear to me why this would be something that needs to wait for PHP 9.
Best regards
Tim Düsterhus
PS: Please take care of threading, your initial email regarding your proposal was in reply to Pierre's email regarding the fromSeconds() constructor, which was incredibly confusing. See the thread view at https://news-web.php.net/php.internals/131989.