Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:108981 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 85575 invoked from network); 11 Mar 2020 17:15:11 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 11 Mar 2020 17:15:11 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id BBB3C18054C for ; Wed, 11 Mar 2020 08:36:19 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_NONE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-yw1-f53.google.com (mail-yw1-f53.google.com [209.85.161.53]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Wed, 11 Mar 2020 08:36:19 -0700 (PDT) Received: by mail-yw1-f53.google.com with SMTP id x5so2349755ywb.13 for ; Wed, 11 Mar 2020 08:36:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=newclarity-net.20150623.gappssmtp.com; s=20150623; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=MrJXsB57kgE3z0EEbpgBRVuN3zAOS2PDx4lRmpIo2W4=; b=cM3K0ZciWAw91p7IG+KA8YMvv9CU9Uv0tPMJ+nrU+8XNGTvu7ITxRtwSn1oF+jcDxS Nu3FmxqsiGmMKgCPzUUO9I7n9ZbW7rAE4eNoDbO1oru+Ss/M/G++f3zUVZzCzDfuECT8 pTP62AqB7ak1M3/YuPX1J3bTTC6p8ESr/aABBY/WnHHOnxedQMUqW6gBKaJgNSyzywze E7vsD3JiR46lQP7hg+A4aPRxxEjnCZ0M9ONScx5pStnw4FH++nwnBBvS0qdhq3hmE/FJ ORtLEdRgHhhL8RCm/YADKP3i2Nn09yEHkCk1UnzY5k9tjHJphG/YuOWTXHfVMSA44vbt ewag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=MrJXsB57kgE3z0EEbpgBRVuN3zAOS2PDx4lRmpIo2W4=; b=hbC5lUUKFQPr6sGU7Te4vb7x/8SXli32RWvhWKSQQB4U3URZ4vtD4j9q2Uw3heNAhP ix1dGlSJJDN5/tKO5cy3/1jVBaJgnziHFiKWPOWLXG+xpag6xS2CKnke26YIds0p53FV YpBuTpw/ABnQ3+APUGexk0jQShyo0IrVaucxfgV3/AwGMwoT61JkIMr1mjE/nGY7FpRj 3QOKYMCgwZkOpVg1LW+07Ikgot1Z6qtSkcaUtz7x7CyBvUvvrVimllNc5vpfbi0qQFCZ fPWQ7RAs5iaiHKPnfxYaUEzFHr0Pg/uf6S6REzH95+r5HS5AP2BVcV5/bhiwsJ9Y6M7s CQpQ== X-Gm-Message-State: ANhLgQ2obMUh5Y0PaPnfyqKxYA3tEjqS8jShmaD7BX/taTQsQst4fnuX z/Y4sAJxH65oxGvIkYdnb3ASfA== X-Google-Smtp-Source: ADFU+vtY4l5UInZbAO6yBoiwHgwDLGbFAjSVhZrH7AAkq8IaLcG3bGZIiu4TaiJq6XVkqBBaiVMcZQ== X-Received: by 2002:a81:25d6:: with SMTP id l205mr3787246ywl.139.1583940974412; Wed, 11 Mar 2020 08:36:14 -0700 (PDT) Received: from ?IPv6:2601:c0:c680:5cc0:8dba:c229:7c5e:3d05? ([2601:c0:c680:5cc0:8dba:c229:7c5e:3d05]) by smtp.gmail.com with ESMTPSA id e63sm20264155ywd.64.2020.03.11.08.36.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 Mar 2020 08:36:13 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) In-Reply-To: Date: Wed, 11 Mar 2020 11:36:11 -0400 Cc: PHP internals Content-Transfer-Encoding: quoted-printable Message-ID: <19BA68C1-91FA-48C4-8268-118FBB6E437D@newclarity.net> References: To: Nikita Popov X-Mailer: Apple Mail (2.3445.104.11) Subject: Re: [PHP-DEV] Make sorting stable From: mike@newclarity.net (Mike Schinkel) > On Mar 4, 2020, at 11:42 AM, Nikita Popov = wrote: >=20 > Hi internals, >=20 > Sorting function in PHP currently do not guarantee stability, which = means > that the result order of elements that compare equal is not defined. >=20 > .... >=20 > 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. =20 However, maybe this is an opportunity to create an object-based = interface for array sorting? This could: 1.) Provide the stability guarantee,=20 2.) Be an object alternate to functions,=20 3.) Allow for option discovery via auto-complete in IDEs, and=20 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. =20 If not, no need to reply and a lack of interest will signal this is not = a direction to pursue. -Mike=