Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:125812 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by qa.php.net (Postfix) with ESMTPS id 0779E1A00BD for <internals@lists.php.net>; Sun, 20 Oct 2024 20:22:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1729455875; bh=JokVQhu27Ri4IJk4f7M8Rbu5WeHjwkEOF/qBZTOP0AU=; h=Date:From:To:In-Reply-To:References:Subject:From; b=YVt7gdN2Q5ja6y5sjV7PYaqwKtJWt8x2qljTxPKmW4VoQbOPaY1cX/DhkiHT08bEp Bp+tZ4opLRR4uAh43Zfn5YhJw0/uj77dS3yYQ+SEZv5x9cRsPaRaf/d8qnC7poekFt u3g5dy/f5PpFyrRiU0wuSw/l05G24Ijd6vPdRXlDDZBvNyyNkCl5V70oqW31cnPSbm E6g1hUc2x7k4VyeteBp9QkplS7LmcmxFFkoyBBLz+GlHuNH1/I98I+WS0iXtq2uLAZ x8j9wWdrzkc2mLKqABSvOjd9VmwNgxHPpWCjAtIqNbJsAo2f/fdLHWWacHJ0o+5ysZ bJU6hkeJpPDrQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 7544F180074 for <internals@lists.php.net>; Sun, 20 Oct 2024 20:24:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-0.1 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING,RCVD_IN_DNSWL_LOW, SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: <larry@garfieldtech.com> Received: from fhigh-b2-smtp.messagingengine.com (fhigh-b2-smtp.messagingengine.com [202.12.124.153]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for <internals@lists.php.net>; Sun, 20 Oct 2024 20:24:33 +0000 (UTC) Received: from phl-compute-01.internal (phl-compute-01.phl.internal [10.202.2.41]) by mailfhigh.stl.internal (Postfix) with ESMTP id 23EBF2540091 for <internals@lists.php.net>; Sun, 20 Oct 2024 16:22:10 -0400 (EDT) Received: from phl-imap-06 ([10.202.2.83]) by phl-compute-01.internal (MEProxy); Sun, 20 Oct 2024 16:22:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= garfieldtech.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to; s=fm3; t=1729455729; x=1729542129; bh=Eoclg95aQ4eO+VrQeAFuJ 26YudJdfVcbW2nylqC7L2I=; b=nGkCkSkGHpK5zxrz/NXG4ku1kSLdxf+0G2CG9 v3RLQltDs7LuvqrGn32+2qocu/D7yYGtgR5XlrkaS0rOeOPdPnijzaDN77Lju0eY DEN0lj0WHKRjDbIqdvhDGv0aXhFZRke4dbX5Tb9MmDlxZf+LoOYLdtL1esSAuwc/ Tm6TzLCJ0fw2S+n/wU/nNGBmW9zY582rO3mizvWS9dJmIA8PsK1DHp3c4J3iT6st 32rv7aviKsQW4WxhLDjLpmr/GGTKYXVhUf5RenuBU+MKJl4OQ1s+iVGlUPETdpfn d9Oz2iA0ouam8496uGanp/C4Vk6YhzN7N9EWQutZKd+2vnoRQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1729455729; x= 1729542129; bh=Eoclg95aQ4eO+VrQeAFuJ26YudJdfVcbW2nylqC7L2I=; b=A xK5tQfVUyUo+BB27X4QnQMMD3YfP5gF3J8LA8ANELR+kpaR3t5Tm2z+V/1jz4FJh 4xlNlNp/1TZir0UEKH4sWHznRPE29zIrvCA+3TxBz9OuequaH88u5YW2oDNhXtI3 xtrKezjHi1SxPuZWh8cMwH5goy+T0SAY1olO+h7aPeL7RXhNrFtpMFImB3PBqQtu o/v8kPyqXzl/FyUuTEL2sefPSmxXk+WqXbBdJDFnKEdVXLm7ayyud1GIzkzB84z3 niK0PdtKdM6JrDMmpARLn6rH/Iw2RIA4zEUgNu5Yi1IzpxEKDw1EqOkYAeoBe2Fd dYWnmYM+u+ADz0YFQf0cw== X-ME-Sender: <xms:cWYVZxgAryxr4qmlgAhX52ePjQ6T8sCDJAMtPdsbm4hITXgf1IaDng> <xme:cWYVZ2C2rm6oNHue6rAM8Ew_didC9cSzjV_UPPkZDIjw2RGvsliQYTIY1Brh2v1XR yFJNAQdbZWmkQ> X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrvdehjedgudegjecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivg hnthhsucdlqddutddtmdenucfjughrpefoggffhffvkfgjfhfutgfgsehtjeertdertddt necuhfhrohhmpedfnfgrrhhrhicuifgrrhhfihgvlhgufdcuoehlrghrrhihsehgrghrfh hivghlughtvggthhdrtghomheqnecuggftrfgrthhtvghrnhepueevvdduhffffffhleeu hedvjeevgfelgeetgefftedufeelheegfedvheegleetnecuffhomhgrihhnpehphhhprd hnvghtnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhep lhgrrhhrhiesghgrrhhfihgvlhguthgvtghhrdgtohhmpdhnsggprhgtphhtthhopedupd hmohguvgepshhmthhpohhuthdprhgtphhtthhopehinhhtvghrnhgrlhhssehlihhsthhs rdhphhhprdhnvght X-ME-Proxy: <xmx:cWYVZxE_HnCzXmGvUehm9p16P4I6gAPszS0-jXJF91FoSxsPgahY-w> <xmx:cWYVZ2SMGRBqs2UCbAlo98KgGegoJbHHy3kIFkYxvZ88FlxC-o6CuA> <xmx:cWYVZ-xidi9-ra8MNf0IXmQFX2GLhrl2jglk_2pFEXnCwts7DYJevw> <xmx:cWYVZ87CvuyPKHwS7fiyk5TFiLuCZZ5tX3ryXRl-L3cMetnh8GV4Mw> <xmx:cWYVZztVbzPDtmH_aZuuR6gAlBt3j7urroTstlDBv3cOKmesoAtL3T8b> Feedback-ID: i8414410d:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id A341529C006F; Sun, 20 Oct 2024 16:22:09 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface Precedence: bulk list-help: <mailto:internals+help@lists.php.net list-unsubscribe: <mailto:internals+unsubscribe@lists.php.net> list-post: <mailto:internals@lists.php.net> List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 Date: Sun, 20 Oct 2024 15:21:49 -0500 To: "php internals" <internals@lists.php.net> Message-ID: <20340e0e-ddd0-44cd-b555-1402857eb20f@app.fastmail.com> In-Reply-To: <ZydAaayECTRNG8Ackhb0tDgYjmdFKnkW4p0ISWlLFP5My4CsJBR1KKTylrD14Ags2GUyBLoJPf68N6Z6LoVzjG-tru8YAbmi74W5xzSkJ8I=@gpb.moe> References: <ZydAaayECTRNG8Ackhb0tDgYjmdFKnkW4p0ISWlLFP5My4CsJBR1KKTylrD14Ags2GUyBLoJPf68N6Z6LoVzjG-tru8YAbmi74W5xzSkJ8I=@gpb.moe> Subject: Re: [PHP-DEV] [RFC] Change behaviour of array sort functions to return a copy of the sorted array Content-Type: text/plain Content-Transfer-Encoding: 7bit From: larry@garfieldtech.com ("Larry Garfield") 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