Re: [RFC] [DISCUSSION]: Closure from callable
| From: | Pavel Kouřil | Date: | Sun, 04 Oct 2015 11:31:26 +0000 |
| Subject: | Re: [RFC] [DISCUSSION]: Closure from callable | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-88664@lists.php.net to get a copy of this message | ||
On Sun, Oct 4, 2015 at 12:41 PM, Marco Pivetta <ocramius@gmail.com> wrote:
> As mentioned already by Andrea: why not just a named constructor on the
> closure class, like
Closure::fromCallable(callable $callable)?
> Much simpler, easier to find, etc etc...
> On Sep 29, 2015 11:23, "Dan Ackroyd" <danack@basereality.com> wrote:
>
>> Hello internals,
>>
>> I'd like to start a discussion of a proposal to allow closures to be
>> created in user-land without having to use a whole lot of reflection
>> code.
>>
>> https://wiki.php.net/rfc/closurefromcallable
>>
>> Thanks to Joe and Bob for the assistance in the patch.
>>
>> cheers
>> Dan
>> Ack
>>
>> --
>> PHP Internals - PHP Runtime Development Mailing List
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
Hello,
and what about changing the empty ctor of Closure to
__construct(callable $callable)?
And the usage would be new Closure([$this, 'abc']);?
Regards
Pavel Kouřil