Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:125819 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 7D3581A00BD for ; Mon, 21 Oct 2024 05:23:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1729488350; bh=h4jib8M634YMD3bnOER6HEuN8/0X0wCYn4AszyEm2o0=; h=Date:From:To:In-Reply-To:References:Subject:From; b=lwdeQdCQD/BZk9qVBmC+mHH+2pvUFf40bMp4Qo7fc264BqdIzORp6ItU2qV4wN/4J Tgwa/0tjz44FXQyeQ1Y5YeY788550ssOu90/11JfsArDBlo6LvNd+ViR0dkCQLvtnG 8E4E2ZBAHMIz/yCYMZeHOE+nk+XhtwcvKTSKoLOqQqmZXOWn3SQMV7A9GaaCzXrov6 jDcBtS5vNDNwm5VUoq8LzoAzIcGIYMdQQSwA8pgTa1r2nmtD7BgXkrZ9tYIvJnTi/f vA6LnVImOu/OCeygqhqODk29MmBvSMuTAnTJbptNWLV3WfbXrzMYAFzkqzlLMKDlIq e2kU3d1ugjkBQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 0B9F8180061 for ; Mon, 21 Oct 2024 05:25:50 +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: Received: from fhigh-a3-smtp.messagingengine.com (fhigh-a3-smtp.messagingengine.com [103.168.172.154]) (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 ; Mon, 21 Oct 2024 05:25:49 +0000 (UTC) Received: from phl-compute-01.internal (phl-compute-01.phl.internal [10.202.2.41]) by mailfhigh.phl.internal (Postfix) with ESMTP id 3C0D811401D0 for ; Mon, 21 Oct 2024 01:23:25 -0400 (EDT) Received: from phl-imap-06 ([10.202.2.83]) by phl-compute-01.internal (MEProxy); Mon, 21 Oct 2024 01:23:25 -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=1729488205; x=1729574605; bh=Ruq0EsZQAsHKCBpT8bRg1 dqA+5bAqMDFRR+Vo2x1aYg=; b=lo246jtCYPkKpYlj/hROZ0GV8FbDu6ku4ZkLc cIB2j96C1HA06az9zAA87k/jYhxbNmtZG4IcJcjxV0LP/xHHs8AXhXd1UlJVK4g+ Bte6NCm4Fsb7LGT/cCOADuN4Zet0Jg35KWElatY+qlEQmjcW2+yyf0Z7QvgOfKx6 AHCQi5TsaC7gMwXFQNpF4YwTINb7fttcvQMH37qBmW10js7WLS+a+/AcZchXgrlv wdLz4MzT4Y9hrth/2H1e9AeqTo4duet52PU6FqZqAG9a22t9gVjQhdwY91Y3pTri SnDjOlpkSZQZYZl7jiYlSuPsYL/lssqTKQ/PTAC5mVoqL1VwA== 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=1729488205; x= 1729574605; bh=Ruq0EsZQAsHKCBpT8bRg1dqA+5bAqMDFRR+Vo2x1aYg=; b=k WmVZBkiVB3/+TCbmMBUgrAokQ5NIbTlsnpze8TkTj86TQAYPvmxCXMvql+mb6fZp psv2eRGi/Y2ZyoI1myY0brRfU2rAlsVwrJVB024btGU0SSC8ECjs3h+jCP7Cr2K2 GIZuKBPMQJqxiuYsbx2h+VZ/QBtktpdNCuskxv8ndvTaGANlETlvx0HU7ukhCdIu 0KO6IOa+nWdURxOUxn/s6Zhn4jpKmdTP62fVwzV7BEe5gG3KM4gNZdSPSXU9413H 0mYxNrwUHX7Ps5XtkXbs2SgEAUw7cHgRyCQaD9P1m/fvjUZhHMKd3jpz3QZpmrMW Xb8heIB0xbpNx55nf3vDw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrvdehkedgleeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnecujfgurhepofggfffhvffkjghfufgtgfesthhqredtredtjeen ucfhrhhomhepfdfnrghrrhihucfirghrfhhivghlugdfuceolhgrrhhrhiesghgrrhhfih gvlhguthgvtghhrdgtohhmqeenucggtffrrghtthgvrhhnpeffieeivdfhvdeguddttdeg teeiueegvefhteehfeeffeetudeitdehtdegjeeuieenucevlhhushhtvghrufhiiigvpe dtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehlrghrrhihsehgrghrfhhivghlughtvggt hhdrtghomhdpnhgspghrtghpthhtohepuddpmhhouggvpehsmhhtphhouhhtpdhrtghpth htohepihhnthgvrhhnrghlsheslhhishhtshdrphhhphdrnhgvth X-ME-Proxy: Feedback-ID: i8414410d:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id D2E1D29C006F; Mon, 21 Oct 2024 01:23:24 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 Date: Mon, 21 Oct 2024 00:22:55 -0500 To: "php internals" Message-ID: <352272ef-55f4-41a5-a083-5ab933adf4e5@app.fastmail.com> In-Reply-To: References: <20340e0e-ddd0-44cd-b555-1402857eb20f@app.fastmail.com> Subject: Re: [PHP-DEV] [RFC] Change behaviour of array sort functions to return a copy of the sorted array Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: larry@garfieldtech.com ("Larry Garfield") On Sun, Oct 20, 2024, at 4:39 PM, Bob Weinand wrote: > On 20.10.2024 23:23:21, Ilija Tovilo wrote: >> Hi Bilge >> >> On Sun, Oct 20, 2024 at 10:30=E2=80=AFPM Bilge wrote: >>> I fail to see the logic of present tense =3D mutate, past tense =3D = 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. >> It's sorted, the adjective. As in, "give me a _sorted_ array", >> compared to "_sort_ this array". It's a common convention and I always >> found it intuitive. >> >> Ilija > > Hey Ilija, > > yes, I agree it's intuitive. > > However, I consider it bad to add extra functions for this behaviour.=20 > There's very little gain in extra functions, sort(), sorted(),=20 > shuffle(), shuffled(), etc.. > > So yeah, I'd agree on the naming *if* these were the only variation of=20 > sorting/shuffling etc. functions. But that's not the case here. > > > I, for my part, very much like the RFC, for that it gives functionalit= y,=20 > which I've been missing quite some times already and is minimally inva= sive. > > Bob I am confused by this statement. How is "adding more functions that do = exactly what they say on the tin and act in a predictable fashion" bad? = It's not like we're running out of space for functions. Small, purpose= -built, highly-predictable APIs that fully address a problem space are t= he ideal goal; the number of them is largely irrelevant. I wouldn't mind array_sorted() instead of sorted(), since it wouldn't wo= rk on iterables. But array_sort() vs sort() is just horribly confusing = for no good reason, and the API itself does nothing to tell you which is= which. --Larry Garfield