Re: Typed constants revisited
| From: | Pierre | Date: | Thu, 24 Mar 2022 15:20:27 +0000 |
| Subject: | Re: Typed constants revisited | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-117415@lists.php.net to get a copy of this message | ||
Le 24/03/2022 à 16:06, Mark Niebergall a écrit :
So you are correct, the const value does have a value that has a type, but there is no way to enforce which type the value is or to use const with inheritance, which is part of the bigger picture here.That was exactly my point: the type could simply implicitely be the one of the original value. Then the engine just has to use the existing covariance/contravariance rules for type checks based upon the guessed value type. This would fix the type safety issue you are referring to. -- Regards