On Fri, 23 Jul 2021, Nicolas Grekas wrote: > as proposed by Nikita and Joe, I'm submitting this late RFC for your > consideration for inclusion in PHP 8.1. Intersection types as > currently accepted are not nullable. This RFC proposes to make them > so. > > I wrote everything down about the reasons why here: > https://wiki.php.net/rfc/nullable_intersection_types > > Please have a look and let me know what you think.
From the RFC: «Taking all these elements into account, the preference of... and thus to use the "?X&Y" syntax». I think this would be a mistake. You touch upon operator precedence, and needing to know whether | or & is higher, and inventing a new precedence for ?. I would strongly advocate for not getting into the realm with any operator precendence, but instead *require* parenthesis for any combination. This gives the code reader and writer an immediate clue about what the code does. Most coding standards also recommend this for expressions in "if" statements and the like. I do however agree with Sara's «over-delivering syntax that hasn't been entirely thought through» point. It will take a lot longer to come up with a proposal to combine intersection and union types. That in combination that you're proposing this RFC after feature freeze, while you've had four months to make this arguments as part of the "Pure Intersection Types" RFC, I am currently not going to support this RFC for inclusion into PHP 8.1. cheers, Derick -- PHP 7.4 Release Manager Host of PHP Internals News: https://phpinternals.news Like Xdebug? Consider supporting me: https://xdebug.org/support https://derickrethans.nl | https://xdebug.org | https://dram.io twitter: @derickr and @xdebug
-- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: https://www.php.net/unsub.php