Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:125820 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 8D86F1A00BD for ; Mon, 21 Oct 2024 08:04:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1729498022; bh=wsZZRiUbA7Uunxx2JLWe8bAxR+8GQbuzl4S2J6LOURw=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=HFjH56kzLlZnst6gC82fsipP4TY3TELELoEwz1RW9j/fmqXFRRV5Xt8SMwgLiYYF5 lCmFDvoHG3vQ+kx1vJ77BU4jDI5lUSbBgqfaLv+YxEe5laRx4F5VhBm2X1udoQeO1a F6vDCpaOD8sJilj8A8J1LfM8LY/2EBDz+yowm64Rgyawqz9OQk3DLT8gJg4XR2Sp3t TTJdLbmlU904RzznVO1e+soOSjeiyaqsLX/7yIKan3UWDDAxOxKmxDD8D8MH9N4fxv zet5xHdA7AhSFBOMVEgwDyEO0aTbAFQVXwuSg8THEZ8TyhUHL8oV85feqYHzkKK/3t PwGNCuzge54lw== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 79871180059 for ; Mon, 21 Oct 2024 08:07:02 +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.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,FREEMAIL_FROM, HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from mail-lf1-f50.google.com (mail-lf1-f50.google.com [209.85.167.50]) (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 08:07:01 +0000 (UTC) Received: by mail-lf1-f50.google.com with SMTP id 2adb3069b0e04-539983beb19so4436048e87.3 for ; Mon, 21 Oct 2024 01:04:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729497876; x=1730102676; darn=lists.php.net; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=hPi1bwvN3HvZictSeL/M2DjrUFSCDJD/gTfkz5fPq8A=; b=YFKnaN6D44caIK8m92boQe3uxuPMfZOazAaJoVYvta9rpyhLR4aTFnnNHOotEKDKk0 4Fg9HADGbWBqnKczDCIcHrVi2bX0KLqlCyKGX482NyMqsrA7VTCGt6eU0azs+v2YRhwY UNZ7G1NTjZ30PDgzbWjm+HOzPTKGU1Jcc25UERxA3WObmM8TAfnk0oG29UrMIjL5atg7 M8rVKWaBQomsAiBwtTmBz73GdepgTcA/09otitbRhBgywSoSxs9njEdPHB/bOuDJHNSx 2ZZ6DVjwIZLCryU+P8kbLR/nD6Snl9kTsILjVX8FzlRAGFZXqBb2RIP/Ea/mLjuzbdyl lKLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729497876; x=1730102676; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=hPi1bwvN3HvZictSeL/M2DjrUFSCDJD/gTfkz5fPq8A=; b=aj0tsVCIZBpVhXi351iReFv/UbH19mZ7hr8eztK1C06RCDGemkSho0ZctS+myDF+A/ xhUiXHg76T0zCtVBoXK6ZTqlk8Wgyoz0ADP9PNCtueFMjSYSUOUA28fPtonKwKCSESRc IdbqeKqtNKJDp8rKmwxmUTMpyw126xYhmuk/gDGB47Vhx4WpioPIIL4ADxkhb0rpvnx9 ZF6sOelgLhUTUy0Qk9WecitJxosrufNxN3JqmkLW8Wm61Mn5GK8EJzvqSRQbsCqmQ2Aw 6UB5cPSSZGD5h0L3eFlbEUPEfh4CLOfmtNPJIRNb8PVsYEdpyHolHoSU5BCKnleQQqqr 4bGQ== X-Gm-Message-State: AOJu0YxFnjgL5HIW1983woYBaxlrJKMSCakAx3vIcSiyS0Nw3Il5huif GItMysBPU3Rb/vtNdKLj614NO7Q1Fnu8hpXKU3jLa35IDhR7K7yB9Y4LsOSTqass8Y17bZXruHy I8HKxv/omMjRTDBLyoolqhRItodVF3A== X-Google-Smtp-Source: AGHT+IFEjfLrYNy4WMcz4GDEb5/ew9Fmck+TLDeN24cSRKCnpYDL6bB66NRkBtH1bpYHp7DIFrHA35sWcze1u12f7nU= X-Received: by 2002:a05:6512:31d2:b0:53a:1337:5ff7 with SMTP id 2adb3069b0e04-53a154e79d3mr4739960e87.40.1729497875389; Mon, 21 Oct 2024 01:04:35 -0700 (PDT) Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 References: <20340e0e-ddd0-44cd-b555-1402857eb20f@app.fastmail.com> <352272ef-55f4-41a5-a083-5ab933adf4e5@app.fastmail.com> In-Reply-To: <352272ef-55f4-41a5-a083-5ab933adf4e5@app.fastmail.com> Date: Mon, 21 Oct 2024 18:04:23 +1000 Message-ID: Subject: Re: [PHP-DEV] [RFC] Change behaviour of array sort functions to return a copy of the sorted array To: Larry Garfield Cc: php internals Content-Type: multipart/alternative; boundary="00000000000080a8940624f81a91" From: mickmackusa@gmail.com (mickmackusa) --00000000000080a8940624f81a91 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, Oct 21, 2024 at 3:24=E2=80=AFPM Larry Garfield wrote: > 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 the ideal goal; the number of them is largely irrelevant. > > I wouldn't mind array_sorted() instead of sorted(), since it wouldn't wor= k > 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 > Couldn't it be said that prefixing native array functions with "array_" and not adding "ed" to the middle (e.g. array_walked_recursive) or end of native functions is moving toward naming convention normalcy? Does PHP have any "ed" functions? Having separate array_*() and *() functions offers a path to the possible future decision to cull the *() functions and/or remove the modify-by-reference behaviour of array_*() functions ...if that is ever desirable. I see this naming distinction as a stepping stone to a more consistent naming convention rather than the final solution. (Just like defining the function alias preg_escape() as a pathway to removing preg_quote() -- which is a function that doesn't do what it says on the tin.) Mick --00000000000080a8940624f81a91 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


=
On Mon, Oct 21, 2024 at 3:24=E2=80=AF= PM Larry Garfield <larry@garfieldtech.com> wrote:
I am confused by this statement.=C2=A0 How is = "adding more functions that do exactly what they say on the tin and ac= t in a predictable fashion" bad?=C2=A0 It's not like we're run= ning out of space for functions.=C2=A0 Small, purpose-built, highly-predict= able APIs that fully address a problem space are the ideal goal; the number= of them is largely irrelevant.

I wouldn't mind array_sorted() instead of sorted(), since it wouldn'= ;t work on iterables.=C2=A0 But array_sort() vs sort() is just horribly con= fusing for no good reason, and the API itself does nothing to tell you whic= h is which.

--Larry Garfield

Couldn't it be said that pref= ixing native array functions with "array_" and not adding "e= d"=C2=A0 to the middle (e.g. array_walked_recursive) or end of native = functions is moving toward naming convention normalcy?
Does PHP h= ave any "ed" functions?
Having separate array_*() and *= () functions offers a path to the possible future decision to cull the *() = functions and/or remove the modify-by-reference behaviour of array_*() func= tions ...if that is ever desirable.
I see this naming distinction= as a stepping stone to a more consistent naming convention rather than the= final solution.
(Just like defining the function alias preg_esca= pe() as a pathway to removing preg_quote() -- which is a function that does= n't do what it says on the tin.)

Mick
--00000000000080a8940624f81a91--