On 13/03/2023 20:44, Larry Garfield wrote:
As has been discussed numerous times, all of the most used array functions need
to be redesigned to work with iterables, and in many cases make more sense.
That would be a natural time to also revisit parameter order to fit with
whatever partial application syntax was in use.
It's not just the array functions, though, it's every single function
built into PHP, and an even longer list of userland library and
framework functions; and there will always be competing reasons for
preferring one signature over another. What attracts me about features
like PFA is precisely that they let you work in new ways *without*
having to rewrite all of that.
Some more examples of placeholder-first application, from a quick skim
through the documentation:
$escape = htmlspecialchars(?, ENT_XML1);
$containsAt = str_contains(?, '@');
$priceFormatter = number_format(?, 2, ',', '.');
$addSigToFile = file_put_contents(?, $signature, FILE_APPEND);
$takeOwnership = chown(?, get_current_user());
$encode = json_encode(?, JSON_THROW_ON_ERROR | JSON_PRESERVE_ZERO_FRACTION);
$unserialize = unserialize(?, ['allowed_classes' => false]);
$isLogger = is_subclass_of(?, LoggerInterface::class, false);
I'm sure I could look through Laravel's documentation, or Symfony's, and
find examples there too.
Regards,
--
Rowan Tommins
[IMSoP]
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php