rfc:dnf_types
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
rfc:dnf_types [2021/11/04 21:30] – Add note on redundant types crell | rfc:dnf_types [2023/01/21 22:12] (current) – Typo in code example, brakets are not allowed for standalone intersection types girgias | ||
---|---|---|---|
Line 2: | Line 2: | ||
* Version: 0.9 | * Version: 0.9 | ||
* Date: 2021-11-04 | * Date: 2021-11-04 | ||
- | * Author: George Peter Banyard, girgias@php.net; | + | * Author: George Peter Banyard |
- | * Status: | + | * Status: |
* First Published at: http:// | * First Published at: http:// | ||
Line 63: | Line 63: | ||
< | < | ||
- | (A& | + | (A& |
(B& | (B& | ||
null|(C& | null|(C& | ||
</ | </ | ||
- | Requiring DNF for all type declarations allows conceptually all potential combinations of intersection and union rules, but in a standard fashion that is easier for the engine and easier for humans and static analyzers to comprehend. It also obviates the need for parentheses anywhere in the type definition. | + | Requiring DNF for all type declarations allows conceptually all potential combinations of intersection and union rules, but in a standard fashion that is easier for the engine and easier for humans and static analyzers to comprehend. |
- | The parentheses around each intersection | + | The parentheses around each intersection |
==== Return co-variance ==== | ==== Return co-variance ==== | ||
Line 83: | Line 83: | ||
// Acceptable. | // Acceptable. | ||
class TestOne implements ITest { | class TestOne implements ITest { | ||
- | public function stuff(): | + | public function stuff(): A&B {} |
} | } | ||
Line 166: | Line 166: | ||
A type declaration of '' | A type declaration of '' | ||
- | Note that a type declaration of '' | + | Note that a type declaration of '' |
+ | |||
+ | * Segments that are strict subsets of others are disallowed. | ||
+ | |||
+ | For example, the type definition '' | ||
This does not guarantee that the type is " | This does not guarantee that the type is " | ||
Line 174: | Line 178: | ||
This RFC does not introduce any new reflection classes. | This RFC does not introduce any new reflection classes. | ||
- | '' | + | '' |
===== Backward Incompatible Changes ===== | ===== Backward Incompatible Changes ===== | ||
Line 184: | Line 188: | ||
8.2 | 8.2 | ||
- | ===== Open Issues | + | ===== Vote ===== |
- | Make sure there are no open issues when the vote starts! | + | As per the voting RFC a yes/ |
- | ===== Unaffected PHP Functionality ===== | + | Voting started on 2022-06-17 and will end on 2022-07-01. |
- | + | <doodle title=" | |
- | List existing areas/features of PHP that will not be changed by the RFC. | + | * Yes |
- | + | * No | |
- | This helps avoid any ambiguity, shows that you have thought deeply about the RFC's impact, and helps reduces mail list noise. | + | </doodle> |
===== Future Scope ===== | ===== Future Scope ===== | ||
Line 198: | Line 202: | ||
==== Non-DNF types ==== | ==== Non-DNF types ==== | ||
- | In theory, supporting conjunctive normal form type definitions (and ANDed list of ORs) may be possible. | + | In theory, supporting conjunctive normal form type definitions (and ANDed list of ORs) or types which are not in a normalised form may be possible, either by supporting them directly or doing a compile time rewrite of the type expression. |
+ | |||
+ | However, as DNF is able to represent all reasonable boolean expressions | ||
==== Type aliasing ==== | ==== Type aliasing ==== | ||
Line 210: | Line 216: | ||
===== Patches and Tests ===== | ===== Patches and Tests ===== | ||
- | Patch is available here: https:// | + | Patch is available here: https:// |
===== Implementation ===== | ===== Implementation ===== |
rfc/dnf_types.1636061449.txt.gz · Last modified: 2021/11/04 21:30 by crell