On Fri, Jul 23, 2021 at 4:31 PM Deleu <deleu...@gmail.com> wrote:

> On Fri, Jul 23, 2021 at 2:36 PM Derick Rethans <der...@php.net> wrote:
>
> > 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
>
>
> These are precisely everything I think about this RFC. The only thing the
> RFC made clear is why it is easy to make an exception for null while still
> not providing a full mix of union and intersection.
>
> Maybe my memory is also really bad, but the RFC makes it seem like version
> 7.0 was a mistake to be learned from which isn't clear for me. I understand
> that introducing nullable intersection later will warrant a major version
> and I don't see a problem with that. Pure Intersection RFC was such a
> breeze vote precisely because it didn't involve the complexity of mixing
> with union. Part of that complexity is now being rushed after feature
> freeze.
>

As a maintainer of a large open source library, yes 7.0 was a problem due
to the nullability missing for return types and was the reason why a lot of
open source libraries jumped from minimum 5.4/5.5/5.6 directly to 7.1 to
avoid breaking BC twice for classes/interfaces when a signature of the
following kind was present:

/**
* @param string $foo
 * @return ?string
 */
function foo () { }

php 7.0: foo(string $foo) {}
php 7.1: foo(string $foo) : ?string {}


> --
> Marco Aurélio Deleu
>

Reply via email to