Re: [RFC] Nullable intersection types
| From: | Pierre | Date: | Fri, 23 Jul 2021 16:06:34 +0000 |
| Subject: | Re: [RFC] Nullable intersection types | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-115566@lists.php.net to get a copy of this message | ||
Le 23/07/2021 à 17:56, Levi Morrison via internals a écrit :
Accumulating union and sum types is probably not something I'd do every day, so in the end, I'll probably always go and read the documentation each and every time. But for people that do, they'll get used to it fast enough I think. This behavior seems fine, at least I think it's fine, as long as the documentation is clear. Regards, -- PierreAs you note in the RFC, PHP already definesI want to acknowledge and reject this. Few people keep the bitwise precedence information in their head. It's not worth it -- just require parenthesis. I don't want to reject this, this is actually a very good point, do not reinvent a syntax that works somewhere else. And in the end, I do find this readable. (I prey that people will use space in they types definitions to make it even more readable, but style is not a topic for this RFC.)|as having a lower precedence than&, soX & Y | nullcan only be interpreted as(X & Y) | null. This is consistent with other languages such as TypeScript, whereA & B | C & Dis 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 theA & B | nullsyntax.