> On Mar 4, 2020, at 11:42 AM, Nikita Popov <nikita....@gmail.com> wrote: > > Hi internals, > > Sorting function in PHP currently do not guarantee stability, which means > that the result order of elements that compare equal is not defined. > > .... > > What do people think about this? Is there interest in making sorting > stable? Is it okay to break code using illegal comparison callbacks?
I see that most people are okay with the BC breaks on this, and worst case I am okay with them too. However, maybe this is an opportunity to create an object-based interface for array sorting? This could: 1.) Provide the stability guarantee, 2.) Be an object alternate to functions, 3.) Allow for option discovery via auto-complete in IDEs, and 4.) Be easier to remember than the current set of functions. In order to have something for people visualize I created this userland example implementation as a straw man for a potential API that could be provided in core: https://gist.github.com/mikeschinkel/dd22513a23852add93f3817ed9544337 If people like this idea, let's discuss. If not, no need to reply and a lack of interest will signal this is not a direction to pursue. -Mike -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php