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
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php