Re: [RFC][VOTE] Closure from callable
| From: | Marco Pivetta | Date: | Mon, 16 May 2016 08:34:59 +0000 |
| Subject: | Re: [RFC][VOTE] Closure from callable | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-93350@lists.php.net to get a copy of this message | ||
On 16 May 2016 at 10:31, Dmitry Stogov <dmitry@zend.com> wrote:
> I'm sorry, I didn't follow the RFC discussion.
> In general I like the idea, but why not to use Closure constructor?
>
> $f = new Closure("some_func");
>
> would look more readable than
>
> $f = Closure::fromCallable("some_func");
>
> Sorry, if this was already discussed before.
>
> Thanks. Dmitry.
>
Constructors can't be used as callbacks, so you wouldn't be able to map
this operation without yet another level of indirection.
A named constructor also leaves more space for later improvements, and is
quite a bit more expressive.
Marco Pivetta
http://twitter.com/Ocramius
http://ocramius.github.com/