Re: [PHP-DEV] Re: [RFC] [Discussion] Literal Scalar Types

[email protected] (Jorg Sowa)
Newsgroups php.internals
Message-ID <CAPTD5yFtQmWPTbArdD-gtVGxCBEuhVwR2BMcF=AtDOOcJ4OJ9Q@mail.gmail.com>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.