On Sun, 20 Oct 2024, 21:24 Larry Garfield, <la...@garfieldtech.com> wrote:

> On Sun, Oct 20, 2024, at 12:42 PM, Gina P. Banyard wrote:
> > Hello internals,
> >
> > I would like to propose a short RFC to make the return value of the
> > sort() and similar functions more useful:
> > https://wiki.php.net/rfc/array-sort-return-array
> >
> > I intend for the discussion to last 2 weeks and then open the vote.
> >
> > Best regards,
> >
> > Gina P. Banyard
>
> Like others, I'm skeptical of the behavior here not being all that clear.
>
> What several other languages do, and what I have in the plan for
> collections if/when they ever happen, is sort() sorts in place, while
> sorted() returns a new value.  There's similarly reverse() (in place) and
> reversed() (new value returned).
>
> *sorted($arr) seems like it would be a lot less confusing, and consistent
> with what other languages (and hopefully future PHP) do.  (I don't know
> what that means for array_walk(), but I don't know what that would even
> return anyway.)
>
> --Larry Garfield
>

I fail to see the logic of present tense = mutate, past tense = copy. At
least there is a pattern to it, but I would have to look it up several
times before it sunk in since it is not intuitive at all.

Cheers,
Bilge

>

Reply via email to