Re: Re: [RFC] [Discussion] Literal Scalar Types
| From: | Jorg Sowa | Date: | Wed, 01 Jul 2026 20:40:05 +0000 |
| Subject: | Re: Re: [RFC] [Discussion] Literal Scalar Types | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-131679@lists.php.net to get a copy of this message | ||
Hello,
I don't like the current state of this RFC. There is no explanation of what
problem it is trying to solve. It focuses only on the proposed solution,
while the problem space itself has not been properly explored. Because of
that, the RFC also lacks any discussion of alternatives, even though
several have already been suggested in this discussion thread.
The examples in the RFC don't add much value. Hardcoded literal types such
as
function f(1|2|3 $x): int { return $x; } are generally considered an
anti-pattern. Enums were specifically designed for these kinds of cases.
However, the RFC does not explain why enums are insufficient for the
problem it is trying to address (which, again, is never clearly defined).
The performance section is also incomplete, as it does not compare the
proposed feature against enums.
Kind regards,
Jorg