Hi internals,

For unrelated reasons detailed in 
https://github.com/php/php-src/pull/5951#issuecomment-670969676 ,
I'm not planning on continuing work on this due to issues I found thinking 
about the proposal.
I initially started work on this because the intended behavior seemed 
underspecified.

"[No objections] from me, though I don't think I'd use it personally." sums up 
my current stance on that.

> Such a construct would be compile-time evaluated, so not having a match 
> should result in a compile error.

Constants in PHP are lazily evaluated under some circumstances, e.g. class 
constants in constant expressions defer evaluation if they refer to other class 
constants so that classes aren't unnecessarily autoloaded.
https://github.com/php/php-src/pull/5951/files#diff-96ef697f12a482e3f2a7cb0966a6c5beR46
 is an example of UnhandledMatchError in function default params, which are 
also deliberately not permanently cached by C.

Compile-time evaluation was something left out of that implementation, but is 
something that would get added in `zend_const_expr_to_zval`, like it already is 
for AST_CONDITIONAL.

- Tyson
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php

Reply via email to