Re: [RFC] Disjunctive Normal Form Types

From: Date: Sat, 19 Mar 2022 17:15:28 +0000
Subject: Re: [RFC] Disjunctive Normal Form Types
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-117381@lists.php.net to get a copy of this message
On Sat, 2022-03-19 at 16:38 +0000, G. P. B. wrote: > DNF types are a way to mix intersection and union types together in a > single type. > For example: >  - (A&B)|null >  - (Traversable&Countable)|array Hello George, I like your proposal. I would like to offer 2 suggestions however: 1. I think that syntax would be cleaner without the parentheses 2. [Future Scope] I would go against non-DNF types. DNF forms a nice two level structure that's easy to comprehend. Arbitrary expressions may be too much for runtime checks (correct me if I'm wrong) and will definitely have high cognitive complexity. And CNF would allow to form invalid types too easily like (Traversable|null)&Countable Best, Anton

« previous php.internals (#117381) next »