Re: AW: [PHP-DEV] Coercive Scalar Type Hints RFC
| From: | rich gray | Date: | Sun, 22 Feb 2015 14:11:53 +0000 |
| Subject: | Re: AW: [PHP-DEV] Coercive Scalar Type Hints RFC | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-83472@lists.php.net to get a copy of this message | ||
On 22/02/2015 13:09, Robert Stoll wrote:
[snip]
...
PHP 7.1: necessary bug-fixes introduced with PHP 7.0 PHP 7.x: deprecate even more if required PHP 8: - introduce scalar type hints which reflect the conversion rules as defined (adding strict type hints as well is possible of course, whether with an ini-setting, a declare statement or individually with a modifier something like "strict int" for a single parameter or strict function for all parameters incl. return type or strict class for every type defined in the class is up to discussion) - exchange the behaviour of (bool), (int) etc. -> use the new conversion rules instead - change internal functions which do not yet obey to the new conversion rules - change the operators which do not yet obey to the new conversion rules (for instance, + would also emit an E_RECOVERABLE_ERROR for "a" + 1) - (change the control structures in order that they obey the new conversion rules as well) => as mentioned above, probably too strict for PHP Back to this RFC. think this RFC goes in the right direction with the specified conversion rules. Only thing to get rid of are the implicit conversions to bool from string, float and int IMO. Moreover, I like that the RFC already has different steps for adding the new behaviour. Yet, I think it should slow down a little bit as shown. I think we need more time to come up with a very good strategic solution. Thoughts? +1 - good analysis - a single mode approach with consistent type coercion rules across the board makes absolute sense even if STH are put back until PHP 8.x