Re: [RFC] Closure::call and Function Referencing as Closures
| From: | Andrea Faulds | Date: | Mon, 04 Aug 2014 19:49:36 +0000 |
| Subject: | Re: [RFC] Closure::call and Function Referencing as Closures | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-76347@lists.php.net to get a copy of this message | ||
On 4 Aug 2014, at 20:41, Rowan Collins <rowan.collins@gmail.com> wrote:
> > It does not permit dynamic references such as |&$classname::foo|, due to conflicts
> > with existing syntax and for symmetry (while |&$classname::foo| would be doable,
> > |&FooBar::$foo| is not, so we do neither).
>
> I'm not entirely sure of the reasoning in the parentheses, actually. Do you just mean that
> only the &FooBar::$foo case conflicts with existing logic?
Right, while &FooBar::$methodname would conflict, &$classname::foo would not. I do neither
for the sake of consistency, as having one but not the other worse might cause confusion. This has
the benefit, I suppose, that & is completely static. You can see at “compile-time” whether
it’s valid and what function is being used. I think that would be good for static analysis. IMO,
it’d also be good for Hack as it could use this instead of fun().
--
Andrea Faulds
http://ajf.me/