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
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php