Re: [RFC] Duration class
| From: | Tim Düsterhus | Date: | Mon, 13 Jul 2026 14:22:58 +0000 |
| Subject: | Re: [RFC] Duration class | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-131885@lists.php.net to get a copy of this message | ||
Hi
On 2026-07-08 02:49, Pierre Joye wrote:
If injectivity were the real goal, none of Java, Rust, or Temporal would be usable APIs by that standard, they're explicitly non-injective by design, and that hasn't stopped them from being the reference implementations you're citing as inspiration.Lack of method overloading would be one thing, see also: https://news-web.php.net/php.internals/131391. As for the specific case of “the constructors should be injective functions”, you missed the second half of the quoted sentence: “and also based on our experience of working with dates and times both in PHP and other programming languages”, although native support for fixed-point decimals would certainly made the API nicer. Best regards Tim DüsterhusYes, *inspiration*. We looked at those to see how others approach the problem, but of course built our own list of requirements and/or goals based on constraints imposed by PHP and also based on our experience of working with dates and times both in PHP and other programming languages.I wonder, what are the constraints php has for this proposal? And how PHP doing something different than almost any other language is the result of these constraints?