I've also put together a *different* proof of concept adding support for named 
calls of global functions
(and only that, no other new allowed types of expressions) from within the 
expressions of constants.
(i.e. global constants, class constants, and parameter defaults).

I was considering putting together an RFC to allow function calls
once I'm finished implementing that,
and if no major unfixable issues are identified.

https://github.com/TysonAndre/php-src/pull/12 allows expressions such as:

   <?php class X { const MESSAGE = sprintf('hello, %s', 'world'); }

This uses php's default behavior for evaluating constants,
which is delayed until the first use for class constants/param defaults,
and at the time of declaration for global constants.

This POC will throw if the constant would be invalid (same checks as define()) 
(e.g. reject cycles, references, or objects),
and will also throw an Error if a function call tries to load the constant 
currently being defined.
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to