Re: [PHP-DEV] [RFC] [DISCUSSION]: Closure from callable

2015-10-04 Thread Dan Ackroyd
Hi Pavel, On 4 October 2015 at 11:31, Pavel Kouřil wrote: > > and what about changing the empty ctor of Closure to > __construct(callable $callable)? > > And the usage would be new Closure([$this, 'abc']);? > I'm going to change the RFC to use the 'named constructor' Closure::fromCallable which

Re: [PHP-DEV] [RFC] [DISCUSSION]: Closure from callable

2015-10-04 Thread Dan Ackroyd
On 4 October 2015 at 10:16, Ben Scholzen 'DASPRiD' wrote: > > you could just do this: > > return function ($data) { return $this->genericValidation($data); } > > you could just do this: > > return function ($data) { return $this->genericValidation($data); } Yes, there are workarounds possible th

Re: [PHP-DEV] [RFC] [DISCUSSION]: Closure from callable

2015-10-04 Thread Pavel Kouřil
On Sun, Oct 4, 2015 at 12:41 PM, Marco Pivetta 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" wrote: > >> Hello in

Re: [PHP-DEV] [RFC] [DISCUSSION]: Closure from callable

2015-10-04 Thread Marco Pivetta
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" wrote: > Hello internals, > > I'd like to start a discussion of a proposal to allo

Re: [PHP-DEV] [RFC] [DISCUSSION]: Closure from callable

2015-10-04 Thread Ben Scholzen 'DASPRiD'
On 29.09.2015 16:23, Dan Ackroyd 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

Re: [PHP-DEV] [RFC] [DISCUSSION]: Closure from callable

2015-10-01 Thread Bishop Bettini
On Tue, Sep 29, 2015 at 10:23 AM, Dan Ackroyd 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 Bo

Re: [PHP-DEV] [RFC] [DISCUSSION]: Closure from callable

2015-09-29 Thread Levi Morrison
On Tue, Sep 29, 2015 at 8:23 AM, Dan Ackroyd 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

Re: [PHP-DEV] [RFC] [DISCUSSION]: Closure from callable

2015-09-29 Thread Dan Ackroyd
On 29 September 2015 at 14:56, Peter Petermann wrote: > why not just do "return function() { $this->myPrivateMethod(); };" That would not work if there were any parameters to the function. Also all other information would need to be duplicated e.g. the return type. > this should be easy enough t

Re: [PHP-DEV] [RFC] [DISCUSSION]: Closure from callable

2015-09-29 Thread Dan Ackroyd
> On Tue, Sep 29, 2015 at 3:50 PM, Michael Wallner wrote: >> +1, I'm not sure it belongs into ext/reflection, though? On 29 September 2015 at 14:54, Joe Watkins wrote: > +1 on the concept, I tried to argue it belongs in /Zend too ... still think Sure I'll move it to there when I finish off the

Re: [PHP-DEV] [RFC] [DISCUSSION]: Closure from callable

2015-09-29 Thread Ryan Pallas
On Tue, Sep 29, 2015 at 8:23 AM, Dan Ackroyd 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

Re: [PHP-DEV] [RFC] [DISCUSSION]: Closure from callable

2015-09-29 Thread Joe Watkins
+1 on the concept, I tried to argue it belongs in /Zend too ... still think it does ... On Tue, Sep 29, 2015 at 3:50 PM, Michael Wallner wrote: > On 29/09/15 16:23, Dan Ackroyd wrote: > > Hello internals, > > > > I'd like to start a discussion of a proposal to allow closures to be > > created in

Re: [PHP-DEV] [RFC] [DISCUSSION]: Closure from callable

2015-09-29 Thread Michael Wallner
On 29/09/15 16:23, Dan Ackroyd 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 assi