Re: [RFC] Allow calls to global functions in constant expressions
| From: | Mike Schinkel | Date: | Sun, 09 Feb 2020 21:33:44 +0000 |
| Subject: | Re: [RFC] Allow calls to global functions in constant expressions | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-108431@lists.php.net to get a copy of this message | ||
> On Feb 9, 2020, at 4:02 PM, tyson andre <tysonandre775@hotmail.com> wrote:
>
> https://wiki.php.net/rfc/calls_in_constant_expressions has been
> updated and moved to
> "Under Discussion".
>
> This proposes allowing function calls in constant declarations, static property defaults,
> static variables, and parameter defaults.
> It includes a secondary voting option to allow any function calls,
> and not just a small set of whitelisted core functions.
> Other expression types would continue to be forbidden in constant expressions (variables,
> method calls, etc)
>
> Let me know if you have any comments on the RFC or implementation.
1. Why again are MyClass::methodName() not considered for the non-whitelist vote?
Seems to me a developer would be more inclined to implement the expressions that define the class
constant's value in a method of the class than in an external function.
2. Do we really want to add a standard library function 53 characters long?
Can we not come up with a more concise name than
get_defined_functions_allowed_in_constant_expressions(), like maybe get_const_expr_funcs() or
get_const_expressions()?
-Mike