Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:115561 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 95779 invoked from network); 23 Jul 2021 13:50:53 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 23 Jul 2021 13:50:53 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 765841804D0 for ; Fri, 23 Jul 2021 07:16:54 -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=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS 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-yb1-f172.google.com (mail-yb1-f172.google.com [209.85.219.172]) (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:16:54 -0700 (PDT) Received: by mail-yb1-f172.google.com with SMTP id s19so2548596ybc.6 for ; Fri, 23 Jul 2021 07:16:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=datadoghq.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=rbqiZMdSHufrtFKC5u3fbb6cgjJ6iY1JI/s0mx9BN/0=; b=c3QbLzFyD86Xcdi8cVfVuA13OO+WbuHCNfDULLW2l7830Aa8U0AIoEBd7J8OPeuncF fVDZwhC7P3vXZxaYBKngX93j4vq+t08dQonSewglNV8fGNNdkie9IhdlPFeVZsD79HF1 a89MLjdMszSixIMNvy/b+9ig4jHVJlF4hut0E= 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:content-transfer-encoding; bh=rbqiZMdSHufrtFKC5u3fbb6cgjJ6iY1JI/s0mx9BN/0=; b=JgdhTsFDlIbNlVEYj0mLfgfNaoscwPSzF5nXOBuZVbVeg2nOixncaSLl20cqRImm2v XLKKk7oDiCBavOLmEZrOWOW4MYc9i9BsaTgLx7wseRJzEZ8pbODtR0GPxOGYXA8HF5cU kJl/AX/3Cczb2BWPltnzTg4wu+tJFiIOKOdQncFxMgLcPc79dglgwlrPX3+xIK+OyCY2 u8GYbZtaUiE2wMrIxXAB8ZsERyXR1ang3/WqbnxrzidJ9PWPpFq11/SO00mvzTIv4V4N y2InVifoNAuNg8VnGmdMUoupLK5Mud7OLaFaTJYO9QaH7AL8uEvEzc3L/aWg0rRAnw/B B+4A== X-Gm-Message-State: AOAM530hPj8heLXth7vRovJSq0OYXQUxmRpKH55pnIPoPGmvV2J4orA5 6Kl6e3brEA7e9YTBF6Yqduft4D5lQyQdZJKCYED3Rg== X-Google-Smtp-Source: ABdhPJwVsNqvrq3QdVQgwpSlmtg5ePwp2NtvuKV35tNAkoi4bi6u+1AzzDJG0Raspye7+gW/BBKnHp4qcwUCvRTZ768= X-Received: by 2002:a25:e803:: with SMTP id k3mr6727906ybd.268.1627049811357; Fri, 23 Jul 2021 07:16:51 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Reply-To: Levi Morrison Date: Fri, 23 Jul 2021 08:16:40 -0600 Message-ID: To: Derick Rethans Cc: Nicolas Grekas , PHP Internals List Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] [RFC] Nullable intersection types From: internals@lists.php.net ("Levi Morrison via internals") On Fri, Jul 23, 2021 at 6:37 AM Derick Rethans wrote: > > From the RFC: =C2=ABTaking all these elements into account, the preferenc= e > of... and thus to use the "?X&Y" syntax=C2=BB. > > 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 also strongly advocate for always requiring parentheses whenever mixing unions and intersections, and I don't think the nullable shorthand should be omitted from this rule.