Re: Typed constants revisited
| From: | Pierre | Date: | Thu, 24 Mar 2022 07:03:55 +0000 |
| Subject: | Re: Typed constants revisited | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-117410@lists.php.net to get a copy of this message | ||
Le 23/03/2022 à 23:10, Larry Garfield a écrit :
Is there a benefit to it other than "well everything else has types now, so..."? Even if it's esoteric, like in reflection-based meta programming? (I've been dabbling too much in that lately. :-) ) "Everything else does" isn't a compelling argument for me, but there may be others I'm not thinking of. --Larry Garfield Hello,Well I was thinking myself that const being well... constant, and so always defined, type could be determined at compile time without the need to express it in a verbose way. PHP doesn't do any static type inference, but in this case, it could be done almost for free, am I wrong ? If it was determined at compile time, then the type checking on overrides would only be trivial, using the parent occurrence value inferred type. My point is that there's no need to express the type of a value, the value has already has a type. Regards, -- Pierre