Re: [RFC] Change behaviour of array sort functions to return a copy of the sorted array

From: Date: Mon, 21 Oct 2024 20:50:49 +0000
Subject: Re: [RFC] Change behaviour of array sort functions to return a copy of the sorted array
References: 1 2 3 4 5 6  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
On 21/10/2024 21:41, mickmackusa wrote:
On Tue, 22 Oct 2024, 02:30 Valentin Udaltsov, <[email protected]> wrote:
    What if instead of this proposal we reimplement all of the array
    functions in a different namespace and fix a lot of other problems and
    inconsistencies?
    Array\map(iterable $iterable, callable $mapper): array
    Array\sort(iterable $iterable, int $flags = SORT_REGULAR): array
    ...
    --     Valentin
Getting off-topic here The whole discussion thread is "off-topic" in the context of the RFC, but I don't consider that a problem; it's a useful discussion to have whether the RFC sparked it or not.
Regarding the Array\map(iterable $iterable, ...) signature, if new functions are to accept iterables instead of arrays (as they absolutely should) then the Array namespace makes no sense. But at that point we're basically just putting https://github.com/nikic/iter in core (not that that's a bad thing). Cheers, Bilge

Thread (24 messages)

« previous php.internals (#125828) next »