Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:124669 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 86A041A00B7 for ; Mon, 29 Jul 2024 01:19:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1722216073; bh=2BUK2Nl+56Sibslq3XEii46dOqHAIqG5r2bXLW5mYXs=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=Cjc/GO2oARXQqmSCezn1J/6JFSXWyhjZVPozjv0olFTbEiNWg1Hxh5Bt6KaHygGSS NndcBCEbAHgbywo6GxCmDf2ZoAXqDA2h3Y4VsNBnbUaMtTBmSJTL1z0VWt4ORn1Y3l X52v0MmqfNXO6o/n370jzm6aK1uE9j6xxHcNwJxA0vbjS9pM3qbYa6AmJg1fcZiXOg v2na6ip9au4ZzbtsbTiHvcR4PiQ4V2y3pV5nHJXsBFXpsM3kbFfBhOPNKahDVYnAYc rRH5/pKpMuNFSt6ZzspbGI+ER1wQzSXJils6s7Lczg5q0OWNTRDE8GqXgZHp7dub3T FfralNqiRy3CQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 8F516180051 for ; Mon, 29 Jul 2024 01:21:10 +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.8 required=5.0 tests=BAYES_50,DMARC_MISSING, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from megan.smtp.mailx.hosts.net.nz (megan.smtp.mailx.hosts.net.nz [43.245.52.196]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Mon, 29 Jul 2024 01:21:10 +0000 (UTC) Received: from 125-237-145-229-fibre.sparkbb.co.nz ([125.237.145.229] helo=[192.168.1.68]) by megan.smtp.mailx.hosts.net.nz with esmtpsa authed as varteg.nz (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_128_GCM:128) (Exim 4.96) (envelope-from ) id 1sYF2u-008HgN-2F; Mon, 29 Jul 2024 13:19:28 +1200 Message-ID: Date: Mon, 29 Jul 2024 13:19:23 +1200 Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PHP-DEV] [RFC] [VOTE] Deprecations for PHP 8.4 To: Mike Schinkel , "Rowan Tommins [IMSoP]" Cc: PHP internals References: <1a88918e-e808-d778-45e1-53797660e093@php.net> <3563cf9b-8eab-4c82-b525-a5d2f9a767bb@varteg.nz> <38920A4B-790D-48C7-B2F6-C49D3F506232@rwec.co.uk> <951AA94A-8C07-446E-925C-15BB97F146A4@newclarity.net> Content-Language: en-GB In-Reply-To: <951AA94A-8C07-446E-925C-15BB97F146A4@newclarity.net> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Hosts-DKIM-Check: none From: weedpacket@varteg.nz (Morgan) On 2024-07-28 15:54, Mike Schinkel wrote: > > Many (all?) of the functions the Go team adds could have been written in "userland" but they represent such common use-cases that the Go team decided to make them easy and obvious. They even soft deprecate functions and structs that are not ideal and replace them with ones with better names and better signatures. If Go had started with the string and array functions PHP has today they would almost certainly replaced them by now, ~15 years into Go's tenure. > > It is a shame that PHP's culture is so hostile towards adding functionality that could also be added in userland, especially when that functionality would simplify and standardize algorithms that are non-obvious and/or too easy to implement incorrectly. If the PHP culture embraced moving common use-cases into core it would make PHP much more pleasurable to program in and make it much less likely that PHP programs would have bugs and/or security vulnerabilities. > I, too, wish there was more willingness to add useful functions to core. Just saying "they can be implemented in userland" is a bit of a cop-out because, duh, PHP is Turing-complete. A lot of the existing array functions could be replicated by userland (ab)use of array_reduce, and yet no-one would suggest removing them, and if they'd been absent a lot of people would be asking for them. Anyone else wish that sort() took its argument by value instead of by reference? (Solvable in userland.) Or how about a named argument that allowed you to provide a key function to sort on instead of a comparator? (Solvable in userland.) Okay, the first change would break a lot, but an alternate sorted() function that did behave that way could be added. >> On Jul 27, 2024, at 6:14 PM, Morgan wrote: >> Why a SHA2 algorithm? Why not a SHA3 one? How about standalone functions for both, and then when SHA4 comes along (as it inevitably will) another standalone function for one of its variants? > > Yes. Yes, And Yes. > > And ideally within a `\PHP` namespace. > At that point you've got \PHP\sha3() instead of hash("sha3-?"), and now you've (a) lost the word "hash" indicator of what's going on, and (b) hidden the choice of "?" from the user. I'm not really seeing an improvement.