Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:115114 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 76007 invoked from network); 24 Jun 2021 11:40:55 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 24 Jun 2021 11:40:55 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id AA7F51804E3 for ; Thu, 24 Jun 2021 04:59:40 -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=-0.1 required=5.0 tests=BAYES_05,KHOP_HELO_FCRDNS, SPF_HELO_NONE,SPF_NONE,UNPARSEABLE_RELAY autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from processus.org (ns366368.ip-94-23-14.eu [94.23.14.201]) (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 ; Thu, 24 Jun 2021 04:59:39 -0700 (PDT) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by processus.org (Postfix) with ESMTPA id 41D8E5101324; Thu, 24 Jun 2021 11:59:37 +0000 (UTC) To: =?UTF-8?Q?Micha=c5=82_Marcin_Brzuchalski?= , tyson andre Cc: "internals@lists.php.net" References: <0BBAA2F7-02D7-4AEE-B48A-97436A0D8E5D@gmail.com> Message-ID: <326d6cda-c007-f82c-469f-566e1a34e248@processus.org> Date: Thu, 24 Jun 2021 13:59:36 +0200 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Authentication-Results: processus.org; auth=pass smtp.auth=pierre-php@processus.org smtp.mailfrom=pierre-php@processus.org X-Spamd-Bar: / Subject: Re: [PHP-DEV] [RFC] clamp From: pierre-php@processus.org (Pierre) Le 24/06/2021 à 11:44, Michał Marcin Brzuchalski a écrit : > I get an impression that we constantly add things into standard library > which are from a language perspective irrelevant > and that all could be developed in userland with no harm. > > Cheers, > -- > Michał Marcin Brzuchalski Hello, I respectfully do not agree with this last statement. A simple method such as this one entirely belong to the standard library. I wouldn't want to end-up with a NPM-like ecosystem where I'd have to choose between clamp-php, php-clamp, php-bound-int, int-php-bound, etc... The more the standard library will be complete, the less projects will need dependencies, which is better for your projects long term maintenance. You often end-up in dependency resolution hell because library A use library B, which use foo/clamp which is not compatible with another C library you use, or because it doesn't support PHP core version X or Y. A simple function such as clamp in standard library makes much sense, anything like it must go into standard library, this way the userland ecosystem can focus on domain related stuff, or more complex topics, without worrying too much about this kind of detail. Having a great and complete standard library lowers community fragmentation, and that's for the best ! Moreover, it also ensures that all developers speak the same language regarding primitives provided by the standard library, and makes communication more efficient within community. Regards, -- Pierre