Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:115563 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 99909 invoked from network); 23 Jul 2021 14:22:54 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 23 Jul 2021 14:22:54 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 2833918053E for ; Fri, 23 Jul 2021 07:48:55 -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.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,SPF_NONE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-wr1-f42.google.com (mail-wr1-f42.google.com [209.85.221.42]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Fri, 23 Jul 2021 07:48:54 -0700 (PDT) Received: by mail-wr1-f42.google.com with SMTP id q3so2727927wrx.0 for ; Fri, 23 Jul 2021 07:48:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=beberlei-de.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ALcBSYCviNNf0WyGBgWj8fNk+XcVO16vJng36ea0MuU=; b=aGIMzxPxoCjQyEL3T3L1fWG59jc8rl9VcV0d0GFe19EEn/TzXuxl3N++iX1cj78SaI 5gMc999xZRsyRINstQcGJjhArLeevXXfTSaqcVQoIMvRXmp+KxX8pb7NzpID9OGNbXKU gGxfcj1VOK3iWeBfn7w12454B/QpIa4Jg94lWv7jZugJxwh3BjLyE/EwvsiJp7RbmnfY EaOR7S1io/et8dNkPrMNpQpOiWkgGPK+DdLE1XlxK1rALq30r0WnZuyoTy2ZZi2z5KGQ 05QB+soqWqqpFnI7I5hPQzS/W4KqDPhomceCuvLxlwmUHdUS8hoIzG46rHxiQauEXSd+ InvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ALcBSYCviNNf0WyGBgWj8fNk+XcVO16vJng36ea0MuU=; b=TzHaxyJ30ga/0YJcB6slNDlqdBtBqYIh88oHj4hUS0vTqTea5ymnNCnJlD2HsOGXiP onMX8HPqGgIzWVe4KN1aMHMThj0/ZFhVgj3vNJtTgP+PFkNLCbM5sSUSpPrXVBV6ip23 J6w7zPI6ROYoasY/RUT9DSdVnSDHjKCCxqqlwTZmd4uiCJ6rmHPwk+wfDVC+qO3FrZGS nfdF7J4ps42V8wfiYqV5s/pySEMcmTDglYMLtL4OYNS2H3iKofqrECMu0Q0SoN4FOKS8 uWA83iFnAnFGmReWvCTCzrFLEQSrrg5IHPPk33/YLfgj4FfOqTNVDcS74uEZB+EKvJEd vj2Q== X-Gm-Message-State: AOAM531TpqLGOUwrN/YQbuQypuGkxOh5MqG7M1tinYq2wzbgCmI7H+An CW2E1LsdnrWoSb4LaWzwrwwV47cbscHjuhCC96NjPQ== X-Google-Smtp-Source: ABdhPJw9Ma8xgJjyQ7P0LCOctdzZiq2VaPsQf9iffQIa4qzRHgyL8WbWGNJZunxjOGEXPyygJxFZdT9gmCkE+uB6z4U= X-Received: by 2002:a05:6000:2aa:: with SMTP id l10mr2971214wry.116.1627051732035; Fri, 23 Jul 2021 07:48:52 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Fri, 23 Jul 2021 16:48:40 +0200 Message-ID: To: Deleu Cc: Derick Rethans , Nicolas Grekas , PHP Internals List Content-Type: multipart/alternative; boundary="00000000000085000505c7cb80c8" Subject: Re: [PHP-DEV] [RFC] Nullable intersection types From: kontakt@beberlei.de (Benjamin Eberlei) --00000000000085000505c7cb80c8 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, Jul 23, 2021 at 4:31 PM Deleu wrote: > On Fri, Jul 23, 2021 at 2:36 PM Derick Rethans wrote: > > > From the RFC: =C2=ABTaking all these elements into account, the prefere= nce > > of... and thus to use the "?X&Y" syntax=C2=BB. > > > > I think this would be a mistake. You touch upon operator precedence, an= d > > needing to know whether | or & is higher, and inventing a new precedenc= e > > 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 =C2=ABover-delivering syntax that hasn't= been > > entirely thought through=C2=BB 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 "Pur= e > > 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 stil= l > not providing a full mix of union and intersection. > > Maybe my memory is also really bad, but the RFC makes it seem like versio= n > 7.0 was a mistake to be learned from which isn't clear for me. I understa= nd > 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=C3=A9lio Deleu > --00000000000085000505c7cb80c8--