Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:115559 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 86614 invoked from network); 23 Jul 2021 12:10:52 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 23 Jul 2021 12:10:52 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id D4E9C180504 for ; Fri, 23 Jul 2021 05:36:51 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,SPF_HELO_PASS, SPF_NEUTRAL autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS30827 82.113.144.0/21 X-Spam-Virus: No X-Envelope-From: Received: from xdebug.org (xdebug.org [82.113.146.227]) by php-smtp4.php.net (Postfix) with ESMTP for ; Fri, 23 Jul 2021 05:36:51 -0700 (PDT) Received: from localhost (localhost [IPv6:::1]) by xdebug.org (Postfix) with ESMTPS id 512EA10C030; Fri, 23 Jul 2021 13:36:50 +0100 (BST) Date: Fri, 23 Jul 2021 13:36:50 +0100 (BST) X-X-Sender: derick@singlemalt.home.derickrethans.nl To: Nicolas Grekas cc: PHP Internals List In-Reply-To: Message-ID: References: User-Agent: Alpine 2.23 (DEB 453 2020-06-18) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="8323329-133820254-1627043810=:2773" Subject: Re: [PHP-DEV] [RFC] Nullable intersection types From: derick@php.net (Derick Rethans) --8323329-133820254-1627043810=:2773 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE On Fri, 23 Jul 2021, Nicolas Grekas wrote: > as proposed by Nikita and Joe, I'm submitting this late RFC for your=20 > consideration for inclusion in PHP 8.1. Intersection types as=20 > currently accepted are not nullable. This RFC proposes to make them=20 > so. >=20 > I wrote everything down about the reasons why here:=20 > https://wiki.php.net/rfc/nullable_intersection_types >=20 > Please have a look and let me know what you think. From=20the RFC: =C2=ABTaking all these elements into account, the preferenc= e=20 of... and thus to use the "?X&Y" syntax=C2=BB. I think this would be a mistake. You touch upon operator precedence, and=20 needing to know whether | or & is higher, and inventing a new precedence=20 for ?. I would strongly advocate for not getting into the realm with any=20 operator precendence, but instead *require* parenthesis for any=20 combination. This gives the code reader and writer an immediate clue=20 about what the code does. Most coding standards also recommend this for=20 expressions in "if" statements and the like. I do however agree with Sara's =C2=ABover-delivering syntax that hasn't bee= n=20 entirely thought through=C2=BB point. It will take a lot longer to come up= =20 with a proposal to combine intersection and union types. That in combination that you're proposing this RFC after feature freeze,=20 while you've had four months to make this arguments as part of the "Pure=20 Intersection Types" RFC, I am currently not going to support this RFC=20 for inclusion into PHP 8.1. cheers, Derick --=20 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 --8323329-133820254-1627043810=:2773--