Re: [PHP-DEV] Inconsistencies in callable, call_user_func and direct variable calls

2015-03-19 Thread Yasuo Ohgaki
Hi Rowan, On Fri, Mar 20, 2015 at 8:00 AM, Rowan Collins wrote: > I had no intention of restricting the discussion in any way, apologies if > it came across that way. > > Perhaps what I should have said is it is not *only* time that is needed - > we need to design the replacement before it's wor

Re: [PHP-DEV] Inconsistencies in callable, call_user_func and direct variable calls

2015-03-19 Thread Rowan Collins
On 19/03/2015 22:43, Yasuo Ohgaki wrote: Hi Rowan, On Fri, Mar 20, 2015 at 7:12 AM, Rowan Collins mailto:rowan.coll...@gmail.com>> wrote: On 19/03/2015 20:50, Yasuo Ohgaki wrote: Hi Sebastian, On Thu, Mar 19, 2015 at 9:48 PM, Sebastian B.-Hagensen mailto:sbj.ml.r

Re: [PHP-DEV] Inconsistencies in callable, call_user_func and direct variable calls

2015-03-19 Thread Dennis Birkholz
Am 19.03.2015 um 22:11 schrieb Levi Morrison: > On Thu, Mar 19, 2015 at 1:44 PM, Dennis Birkholz wrote: >> Hi, >> >> Am 19.03.2015 um 20:26 schrieb Levi Morrison: >>> On Thu, Mar 19, 2015 at 1:05 PM, Dennis Birkholz >>> wrote: Hi, Am 19.03.2015 um 17:27 schrieb Sebastian B.-Hagens

Re: [PHP-DEV] Inconsistencies in callable, call_user_func and direct variable calls

2015-03-19 Thread Yasuo Ohgaki
Hi Rowan, On Fri, Mar 20, 2015 at 7:12 AM, Rowan Collins wrote: > On 19/03/2015 20:50, Yasuo Ohgaki wrote: > >> Hi Sebastian, >> >> On Thu, Mar 19, 2015 at 9:48 PM, Sebastian B.-Hagensen < >> sbj.ml.r...@gmail.com > wrote: >> >> 2015-03-19 12:51 GMT+01:00 Yasuo

Re: [PHP-DEV] Inconsistencies in callable, call_user_func and direct variable calls

2015-03-19 Thread Rowan Collins
On 19/03/2015 20:50, Yasuo Ohgaki wrote: Hi Sebastian, On Thu, Mar 19, 2015 at 9:48 PM, Sebastian B.-Hagensen mailto:sbj.ml.r...@gmail.com>> wrote: 2015-03-19 12:51 GMT+01:00 Yasuo Ohgaki mailto:yohg...@ohgaki.net>>: > Distinguishing array and callable is problematic. > Array call

Re: [PHP-DEV] Inconsistencies in callable, call_user_func and direct variable calls

2015-03-19 Thread Levi Morrison
On Thu, Mar 19, 2015 at 1:44 PM, Dennis Birkholz wrote: > Hi, > > Am 19.03.2015 um 20:26 schrieb Levi Morrison: >> On Thu, Mar 19, 2015 at 1:05 PM, Dennis Birkholz wrote: >>> Hi, >>> >>> Am 19.03.2015 um 17:27 schrieb Sebastian B.-Hagensen: Another way to unify array and string callback may

Re: [PHP-DEV] Inconsistencies in callable, call_user_func and direct variable calls

2015-03-19 Thread Yasuo Ohgaki
Hi Sebastian, On Thu, Mar 19, 2015 at 9:48 PM, Sebastian B.-Hagensen < sbj.ml.r...@gmail.com> wrote: > 2015-03-19 12:51 GMT+01:00 Yasuo Ohgaki : > > Distinguishing array and callable is problematic. > > Array callable is better to be deprecated in the long run. IMHO. > > Then how would you write

Re: [PHP-DEV] Inconsistencies in callable, call_user_func and direct variable calls

2015-03-19 Thread Dennis Birkholz
Hi, Am 19.03.2015 um 20:26 schrieb Levi Morrison: > On Thu, Mar 19, 2015 at 1:05 PM, Dennis Birkholz wrote: >> Hi, >> >> Am 19.03.2015 um 17:27 schrieb Sebastian B.-Hagensen: >>> Another way to unify array and string callback may be to use the >>> callable syntax and have it return a closure: >>>

Re: [PHP-DEV] Inconsistencies in callable, call_user_func and direct variable calls

2015-03-19 Thread Levi Morrison
On Thu, Mar 19, 2015 at 1:05 PM, Dennis Birkholz wrote: > Hi, > > Am 19.03.2015 um 17:27 schrieb Sebastian B.-Hagensen: >> Another way to unify array and string callback may be to use the >> callable syntax and have it return a closure: >> callable('strlen'); >> callable($object, $methodName); >>

Re: [PHP-DEV] Inconsistencies in callable, call_user_func and direct variable calls

2015-03-19 Thread Dennis Birkholz
Hi, Am 19.03.2015 um 17:27 schrieb Sebastian B.-Hagensen: > Another way to unify array and string callback may be to use the > callable syntax and have it return a closure: > callable('strlen'); > callable($object, $methodName); > callable('class', 'staticMethod') but before that happens, we shou

Re: [PHP-DEV] Inconsistencies in callable, call_user_func and direct variable calls

2015-03-19 Thread Levi Morrison
> There's then the question of what kind of object it would return - a > Closure? Some child or sibling of Closure? What methods could be usefully > provided? Yes, it's a closure. I've actually fleshed this out quite a bit, and there are a few important questions: - With methods do you allow unb

Re: [PHP-DEV] Inconsistencies in callable, call_user_func and direct variable calls

2015-03-19 Thread Rowan Collins
Sebastian B.-Hagensen wrote on 19/03/2015 16:27: Another way to unify array and string callback may be to use the callable syntax and have it return a closure: callable('strlen'); callable($object, $methodName); callable('class', 'staticMethod') Andrea proposed a slightly different syntax for f

Re: [PHP-DEV] Inconsistencies in callable, call_user_func and direct variable calls

2015-03-19 Thread Sebastian B.-Hagensen
Hi, 2015-03-19 17:17 GMT+01:00 S.A.N : >> Then how would you write an callback containing an already constructed >> object? >> $a = [$object, 'method']; >> >> The alternative is unnecessarily cumbersome: >> $a = function($methodArg1, $methodArg2) use($object) { return >> $object->method($methodArg

Re: [PHP-DEV] Inconsistencies in callable, call_user_func and direct variable calls

2015-03-19 Thread Patrick Schaaf
On Thursday 19 March 2015 18:17:50 S.A.N wrote: > > Then how would you write an callback containing an already constructed > > object? $a = [$object, 'method']; > > > > The alternative is unnecessarily cumbersome: > > $a = function($methodArg1, $methodArg2) use($object) { return > > $object->metho

Re: [PHP-DEV] Inconsistencies in callable, call_user_func and direct variable calls

2015-03-19 Thread S.A.N
> Then how would you write an callback containing an already constructed object? > $a = [$object, 'method']; > > The alternative is unnecessarily cumbersome: > $a = function($methodArg1, $methodArg2) use($object) { return > $object->method($methodArg1, $methodArg2); }; $object->$methodName(...$arg

Re: [PHP-DEV] Inconsistencies in callable, call_user_func and direct variable calls

2015-03-19 Thread Vik Hudec
I've always liked how callbacks (well, function pointers) are handled in C - using the function name without parentheses. eg. $a = $object->method; But this wouldn't work in PHP as is, since property and method names would collide. How do people feel about the fact that we have separate propert

Re: [PHP-DEV] Inconsistencies in callable, call_user_func and direct variable calls

2015-03-19 Thread Sebastian B.-Hagensen
Hi, 2015-03-19 12:51 GMT+01:00 Yasuo Ohgaki : > Distinguishing array and callable is problematic. > Array callable is better to be deprecated in the long run. IMHO. Then how would you write an callback containing an already constructed object? $a = [$object, 'method']; The alternative is unneces

Re: [PHP-DEV] Inconsistencies in callable, call_user_func and direct variable calls

2015-03-19 Thread Yasuo Ohgaki
Hi all, On Sun, Mar 15, 2015 at 7:15 PM, Nicolas Grekas < nicolas.grekas+...@gmail.com> wrote: > > >> Foo::bar(); // OK > > >> ['Foo', 'bar'](); // OK > > >> 'Foo::bar'(); // FATAL ERROR > > > > Hi, > > does this topic need to be addressed before PHP7 goes feature freeze? Or is > it a bugfix? (Ju

Re: [PHP-DEV] Inconsistencies in callable, call_user_func and direct variable calls

2015-03-15 Thread Nicolas Grekas
> >> Foo::bar(); // OK > >> ['Foo', 'bar'](); // OK > >> 'Foo::bar'(); // FATAL ERROR > Hi, does this topic need to be addressed before PHP7 goes feature freeze? Or is it a bugfix? (Julien already provided a patch) I'm not familiar with writing RFCs. I fear I won't be able to handle it on schedul

Re: [PHP-DEV] Inconsistencies in callable, call_user_func and direct variable calls

2015-01-24 Thread Rowan Collins
On 24 January 2015 00:15:01 GMT, Stanislav Malyshev wrote: >Hi! > >> Foo::bar(); // OK >> ['Foo', 'bar'](); // OK >> 'Foo::bar'(); // FATAL ERROR > >I'm not sure why one would ever need/want the latter. IMO, it just >looks >weird. Well, they both look weird as literals like that, but the array lo

Re: [PHP-DEV] Inconsistencies in callable, call_user_func and direct variable calls

2015-01-23 Thread Stanislav Malyshev
Hi! > Foo::bar(); // OK > ['Foo', 'bar'](); // OK > 'Foo::bar'(); // FATAL ERROR I'm not sure why one would ever need/want the latter. IMO, it just looks weird. -- Stas Malyshev smalys...@gmail.com -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.n

Re: [PHP-DEV] Inconsistencies in callable, call_user_func and direct variable calls

2015-01-23 Thread Rowan Collins
Andrea Faulds wrote on 23/01/2015 14:37: Hey Nikita, On 20 Jan 2015, at 21:46, Nikita Popov wrote: On Tue, Jan 20, 2015 at 9:54 PM, Marc Bennewitz wrote: valid for call_user_func[_array] and callable type-hint but invalid for for direct variable calls: - string "MyClass::staticFunc" - stri

Re: [PHP-DEV] Inconsistencies in callable, call_user_func and direct variable calls

2015-01-23 Thread Andrea Faulds
Hey Nikita, > On 20 Jan 2015, at 21:46, Nikita Popov wrote: > > On Tue, Jan 20, 2015 at 9:54 PM, Marc Bennewitz wrote: > >> valid for call_user_func[_array] and callable type-hint but invalid for >> for direct variable calls: >> - string "MyClass::staticFunc" >> - string "self::staticFunc" >>

Re: [PHP-DEV] Inconsistencies in callable, call_user_func and direct variable calls

2015-01-23 Thread Nicolas Grekas
> I'm not sure though if it should be done by adding > 'foo::bar' to $a() or removing it from call_user_func(). call_user_func('foo::bar') work since 5.2.2 (see http://3v4l.org/k2SOU). Is there a serious reason to break code that is perfectly fine since 2007. Breaking BC needs a serious reason I

Re: [PHP-DEV] Inconsistencies in callable, call_user_func and direct variable calls

2015-01-22 Thread Stanislav Malyshev
Hi! > It’s technically a 'language change’ and would affect the language > specification. That said, it seems rather “no-brainer”. I think it makes a lot of sense to have call_user_func() and $a() work identically. I'm not sure though if it should be done by adding 'foo::bar' to $a() or removing

Re: [PHP-DEV] Inconsistencies in callable, call_user_func and direct variable calls

2015-01-20 Thread Marc Bennewitz
On 20.01.2015 22:46, Nikita Popov wrote: On Tue, Jan 20, 2015 at 9:54 PM, Marc Bennewitz mailto:dev@mabe.berlin>> wrote: valid for call_user_func[_array] and callable type-hint but invalid for for direct variable calls: - string "MyClass::staticFunc" - string "self::staticFunc"

Re: [PHP-DEV] Inconsistencies in callable, call_user_func and direct variable calls

2015-01-20 Thread Nikita Popov
On Tue, Jan 20, 2015 at 9:54 PM, Marc Bennewitz wrote: > valid for call_user_func[_array] and callable type-hint but invalid for > for direct variable calls: > - string "MyClass::staticFunc" > - string "self::staticFunc" > - string "static::staticFunc" > - string "parent::func" > - string "parent

Re: [PHP-DEV] Inconsistencies in callable, call_user_func and direct variable calls

2015-01-20 Thread Levi Morrison
On Tue, Jan 20, 2015 at 1:59 PM, Adam Harvey wrote: > On 20 January 2015 at 12:54, Marc Bennewitz wrote: >> valid for call_user_func[_array] and callable type-hint but invalid for for >> direct variable calls: >> - string "MyClass::staticFunc" >> - string "self::staticFunc" >> - string "static::s

Re: [PHP-DEV] Inconsistencies in callable, call_user_func and direct variable calls

2015-01-20 Thread Andrea Faulds
Hey Adam, > On 20 Jan 2015, at 20:59, Adam Harvey wrote: > > On 20 January 2015 at 12:54, Marc Bennewitz wrote: >> valid for call_user_func[_array] and callable type-hint but invalid for for >> direct variable calls: >> - string "MyClass::staticFunc" >> - string "self::staticFunc" >> - string "

Re: [PHP-DEV] Inconsistencies in callable, call_user_func and direct variable calls

2015-01-20 Thread Adam Harvey
On 20 January 2015 at 12:54, Marc Bennewitz wrote: > valid for call_user_func[_array] and callable type-hint but invalid for for > direct variable calls: > - string "MyClass::staticFunc" > - string "self::staticFunc" > - string "static::staticFunc" > - string "parent::func" > - string "parent::sta

Re: [PHP-DEV] Inconsistencies in callable, call_user_func and direct variable calls

2015-01-20 Thread Andrea Faulds
Hey Marc, > On 20 Jan 2015, at 20:54, Marc Bennewitz wrote: > > valid for call_user_func[_array] and callable type-hint but invalid for for > direct variable calls: > - string "MyClass::staticFunc" > - string "self::staticFunc" > - string "static::staticFunc" > - string "parent::func" > - strin