On 27/07/2021 14:32, Brent Roose wrote:
 From a userland developer point of view:

- PHP 7.0 types were a pain because of non-nullable types, the feature only 
became really useful as of PHP 7.1


You're not the only person to say this, but I find it really hard to believe.

If this was so urgent that the feature was "not really useful" without it, why did it take twelve years from the addition of type declarations in PHP 5.0 (for classes and interfaces) until the "?" notation in PHP 7.1? Possibly because a syntax to make them nullable *was* added in PHP 5.1 (SomeType $foo=null), which continued to work for all the types available in PHP 7.0. Or possibly because there were enough places where people wanted non-nullable parameters that the feature was useful even if it couldn't be used everywhere.

I can understand wanting to reduce the number of disruptive changes you make to the code base, but whatever version you pick, you can think of something in the next version up that you could wait for instead. Off the top of my head, you could set your minimum to...

* PHP 5.1, for the "array" type declaration
* PHP 5.4, for the "callable" type declaration
* PHP 7.0, for "int", "string", etc
* PHP 7.1, for the "?" nullable notation and "void"
* PHP 7.4, for typed properties
* PHP 8.0, for union types
* PHP 8.1, for pure intersection types
* PHP 8.2, for ... maybe mixed union-and-intersection, maybe type aliases, who knows...

Maybe 7.1 was a sweet spot for you in terms of cost-benefit; maybe 8.1 won't be, but maybe it wouldn't be even with nullable intersections, and 8.2 will be.



Sidenote: weren't there any prior cases where an RFC was accepted only to have 
found out an oversight which resulted in that RFC to be postponed to the next 
release?


That's the opposite of what's being requested here - what's being requested is that an extra feature be added at the last minute, without any changes to the feature already agreed. To my knowledge nobody has so far suggested that the current implementation of intersection types should be removed until this is resolved, and I can't think of any reason why that would make sense.

Regards,

--
Rowan Tommins
[IMSoP]

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

Reply via email to