Re: [RFC] Nullable intersection types
| From: | Levi Morrison via internals | Date: | Fri, 23 Jul 2021 15:56:07 +0000 |
| Subject: | Re: [RFC] Nullable intersection types | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-115565@lists.php.net to get a copy of this message | ||
> As you note in the RFC, PHP already defines
| as having a lower
> precedence than &, so X & Y |
> null can only be interpreted as
> (X & Y) | null. This is consistent with other languages
> such as
> TypeScript, where A & B | C & D is parsed as
> (A & B) | (C & D).
> [2]
>
> Since precedence is already defined for this syntax consistently with
> other languages, I don't think it's necessary to require parentheses
> if we use the A & B | null syntax.
I want to acknowledge and reject this. Few people keep the bitwise
precedence information in their head. It's not worth it -- just
require parenthesis.