Re: [RFC] clamp

From: Date: Thu, 24 Jun 2021 16:08:05 +0000
Subject: Re: [RFC] clamp
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-115122@lists.php.net to get a copy of this message


> On Jun 24, 2021, at 7:59 AM, Pierre <pierre-php@processus.org> wrote:
> 
> 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.

This.  All of this.

-Mike


Thread (12 messages)

« previous php.internals (#115122) next »