Re: [RFC] Nullable intersection types

From: Date: Fri, 23 Jul 2021 14:16:40 +0000
Subject: Re: [RFC] Nullable intersection types
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-115561@lists.php.net to get a copy of this message
On Fri, Jul 23, 2021 at 6:37 AM Derick Rethans <derick@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 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.

« previous php.internals (#115561) next »