Re: [RFC] Time\Instant and Time\Clock
| From: | Tim Düsterhus | Date: | Mon, 05 Oct 2026 15:10:06 +0000 |
| Subject: | Re: [RFC] Time\Instant and Time\Clock | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-132797@lists.php.net to get a copy of this message | ||
Hi
On 2026-10-05 16:53, Nick Sdot wrote:
For the vast majority of PHP developers the exact extension where the code lives is not relevant - they likely don't even know that PHP’s always-enabled standard library is split into multiple extensions, since no action is required for it to be available. Accordingly the RFC also leaves this unspecified as an implementation detail.For the “always enabled” extensions it doesn't really matter *where* the code is located and the (observable) end result for the user is the same (except forIt matters how code is organised. Patterns, assumptions, cognitive load, these, that. I think that's important. A "doesn't really matter *where*" approach is what brings code where core is. I would find it more natural to look at the namespaceReflectionExtension). Time\Duration went into ext/date for simplicity, since timelib is already properly wired into ext/date.Time, and find anext/time. Me getting confused in my last mail shows it nicely. My mail was in draft since you opened the discussion, today I found time to answer and whoops mixed up the polling follow up commit with where things actually live. :)
If "doesn't really matter *where*" stands, then it cannot hurt to separate it. So: why _not_ doing it?ext/date was the pragmatic choice to get things into PHP 8.6. Splitting it out would likely also require a separate ext/timelib extension (similar to ext/lexbor) that provides the underlying library for internal use. Otherwise we would just move some files - that are already entirely standalone - into a separate directory, but not actually do anything meaningful to separate ext/time from ext/date. Best regards Tim Düsterhus