On 30/10/2023 12:24, Alessandro Rosa wrote:
I have posted a new RFC at this link https://wiki.php.net/rfc/empty_function where I suggested some improvements to the standard built-in empty() function and provided a number of examples.


Hi, and welcome!


First, regarding the clarity of the proposal.

You have a few pieces of sample code in the RFC, but the "expected value" comments don't actually match what that code would output. Rather than inline comments on each line, I suggest you give the current output of the whole code, followed by the expected / desired output. I would also suggest replacing "<br/>" with "\n", to keep the code smaller.

Similarly, your PHP-implemented version of the function is trying to be far too clever. If you want to illustrate what you think the rules should be, you need a clear, well-commented function implementing those rules. The first if statement, for instance, is just a very confusing way to write "if ( $input === null ) { return true; }"

Neither style of example really explains why you think your proposed rules make sense. *Why* should boolean true be considered empty? In what situation would you call the function with no arguments and expect a meaningful response?


Second, regarding timescales.

As documented at https://wiki.php.net/rfc/releaseprocess the official policy of the project is that backwards compatibility can only be broken in a major version - that is, the next chance to break compatibility is in 9.0, not 8.anything. While there are often grey areas around this rule, there is absolutely no question that empty() could be removed any time before that. If anything, proposing removal in 10.0 might be more reasonable.


Regards,

--
Rowan Tommins
[IMSoP]

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php

Reply via email to