Re: [PHP-DEV] $arr = array('Hello', 'world'); $arr();

2011-06-06 Thread Felipe Pena
Hi, 2011/6/6 Dmitry Stogov > Hi Felipe, > > I like the idea. It makes indirect method calls less expensive. > > I would add a hint to specializer, to eliminate small overhead for regular > function calls. > > } else if (OP1_TYPE != IS_CONST && > EXPECTED(Z_TYPE_P(function_name) == IS_A

Re: [PHP-DEV] $arr = array('Hello', 'world'); $arr();

2011-06-06 Thread Christopher Jones
On 06/05/2011 08:52 AM, Felipe Pena wrote: Hi all, Reading our bug tracker I noticed a good feature request [1] from 2009 which points to an interesting feature that I think makes sense for us, since we are now working with $f() using objects and strings, and the array('class', 'method') is an

Re: [PHP-DEV] $arr = array('Hello', 'world'); $arr();

2011-06-06 Thread Matthew Weier O'Phinney
On 2011-06-06, Hannes Magnusson wrote: > On Sun, Jun 5, 2011 at 17:52, Felipe Pena wrote: > > Reading our bug tracker I noticed a good feature request [1] from 2009 which > > points to an interesting feature that I think makes sense for us, since we > > are now working with $f() using objects and

Re: [PHP-DEV] $arr = array('Hello', 'world'); $arr();

2011-06-06 Thread Hannes Magnusson
On Sun, Jun 5, 2011 at 17:52, Felipe Pena wrote: > Hi all, > Reading our bug tracker I noticed a good feature request [1] from 2009 which > points to an interesting feature that I think makes sense for us, since we > are now working with $f() using objects and strings, and the array('class', > 'me

Re: [PHP-DEV] $arr = array('Hello', 'world'); $arr();

2011-06-06 Thread Julien Pauli
+1 , nice job Julien On Mon, Jun 6, 2011 at 12:53 PM, David Zülke wrote: > <3 > > David > > > On 05.06.2011, at 17:52, Felipe Pena wrote: > >> Hi all, >> Reading our bug tracker I noticed a good feature request [1] from 2009 which >> points to an interesting feature that I think makes sense for

Re: [PHP-DEV] $arr = array('Hello', 'world'); $arr();

2011-06-06 Thread David Zülke
<3 David On 05.06.2011, at 17:52, Felipe Pena wrote: > Hi all, > Reading our bug tracker I noticed a good feature request [1] from 2009 which > points to an interesting feature that I think makes sense for us, since we > are now working with $f() using objects and strings, and the array('class'

Re: [PHP-DEV] $arr = array('Hello', 'world'); $arr();

2011-06-06 Thread Dmitry Stogov
Hi Felipe, I like the idea. It makes indirect method calls less expensive. I would add a hint to specializer, to eliminate small overhead for regular function calls. } else if (OP1_TYPE != IS_CONST && EXPECTED(Z_TYPE_P(function_name) == IS_ARRAY) && zend_hash_num_element

Re: [PHP-DEV] $arr = array('Hello', 'world'); $arr();

2011-06-05 Thread Stas Malyshev
Hi! 1. We do not use zend_fcall_info stuff in the VM (which zend_is_callable works in) 2. We have to use zend_do_fcall_common_helper instead of zend_call_function() in the VM Yes, I know, I just have a feeling we have two pieces of code doing the same in different way. But I think your propos

Re: [PHP-DEV] $arr = array('Hello', 'world'); $arr();

2011-06-05 Thread Hannes Landeholm
+1 ~Hannes

Re: [PHP-DEV] $arr = array('Hello', 'world'); $arr();

2011-06-05 Thread Felipe Pena
2011/6/5 Stas Malyshev > Hi! > > > We have the code to initialize the call from a object variable, and string >> variable (function only) in this exact opcode ZEND_INIT_FCALL_BY_NAME, >> which >> now treat the array case as well, there is no other place doing such >> stuff. >> > > What about cal

Re: [PHP-DEV] $arr = array('Hello', 'world'); $arr();

2011-06-05 Thread Stas Malyshev
Hi! We have the code to initialize the call from a object variable, and string variable (function only) in this exact opcode ZEND_INIT_FCALL_BY_NAME, which now treat the array case as well, there is no other place doing such stuff. What about call_user_func() implementation? It must be doing p

Re: [PHP-DEV] $arr = array('Hello', 'world'); $arr();

2011-06-05 Thread Felipe Pena
Hi, 2011/6/5 Stas Malyshev > Hi! > > > So, I wrote a patch [2] that allow such behavior to be consistent with >> arrays. See some examples: >> > > Looks good. Only question I have is that we seem to have that code (calling > a function based on variable) in two places instead of one, I wonder i

RE: [PHP-DEV] $arr = array('Hello', 'world'); $arr();

2011-06-05 Thread Zeev Suraski
] $arr = array('Hello', 'world'); $arr(); Hi, 2011/6/5 Zeev Suraski mailto:z...@zend.com>> > -Original Message- > class Hello { >public function world($x) { > echo "Hello, $x\n"; return $this; >} > } > > $f = arr

Re: [PHP-DEV] $arr = array('Hello', 'world'); $arr();

2011-06-05 Thread Felipe Pena
Hi, 2011/6/5 Zeev Suraski > > -Original Message- > > class Hello { > >public function world($x) { > > echo "Hello, $x\n"; return $this; > >} > > } > > > > $f = array(new Hello, 'foo'); > > $f(); > > Am I the only one who doesn't understand what this one is supposed to do..?

Re: [PHP-DEV] $arr = array('Hello', 'world'); $arr();

2011-06-05 Thread Johannes Schlüter
Hi, recently I was surprised this didn't work. so +1 from me. johannes On Sun, 2011-06-05 at 12:52 -0300, Felipe Pena wrote: > Hi all, > Reading our bug tracker I noticed a good feature request [1] from 2009 which > points to an interesting feature that I think makes sense for us, since we > are

Re: [PHP-DEV] $arr = array('Hello', 'world'); $arr();

2011-06-05 Thread Pierre Joye
On Sun, Jun 5, 2011 at 9:52 PM, Zeev Suraski wrote: >> -Original Message- >> class Hello { >>    public function world($x) { >>       echo "Hello, $x\n"; return $this; >>    } >> } >> >> $f = array(new Hello, 'foo'); >> $f(); > > Am I the only one who doesn't understand what this one is su

RE: [PHP-DEV] $arr = array('Hello', 'world'); $arr();

2011-06-05 Thread Zeev Suraski
> -Original Message- > class Hello { >public function world($x) { > echo "Hello, $x\n"; return $this; >} > } > > $f = array(new Hello, 'foo'); > $f(); Am I the only one who doesn't understand what this one is supposed to do..? Zeev

Re: [PHP-DEV] $arr = array('Hello', 'world'); $arr();

2011-06-05 Thread Stas Malyshev
Hi! So, I wrote a patch [2] that allow such behavior to be consistent with arrays. See some examples: Looks good. Only question I have is that we seem to have that code (calling a function based on variable) in two places instead of one, I wonder if it's necessary and if we could unify them.

Re: [PHP-DEV] $arr = array('Hello', 'world'); $arr();

2011-06-05 Thread Ferenc Kovacs
On Sun, Jun 5, 2011 at 5:52 PM, Felipe Pena wrote: > Hi all, > Reading our bug tracker I noticed a good feature request [1] from 2009 > which > points to an interesting feature that I think makes sense for us, since we > are now working with $f() using objects and strings, and the array('class',

Re: [PHP-DEV] $arr = array('Hello', 'world'); $arr();

2011-06-05 Thread Marcel Esser
On Sun, 2011-06-05 at 12:42 -0400, Pierre Joye wrote: > +1, very good job! > > On Sun, Jun 5, 2011 at 5:52 PM, Felipe Pena wrote: > > Hi all, > > Reading our bug tracker I noticed a good feature request [1] from 2009 which > > points to an interesting feature that I think makes sense for us, sinc

Re: [PHP-DEV] $arr = array('Hello', 'world'); $arr();

2011-06-05 Thread Pierre Joye
+1, very good job! On Sun, Jun 5, 2011 at 5:52 PM, Felipe Pena wrote: > Hi all, > Reading our bug tracker I noticed a good feature request [1] from 2009 which > points to an interesting feature that I think makes sense for us, since we > are now working with $f() using objects and strings, and th

Re: [PHP-DEV] $arr = array('Hello', 'world'); $arr();

2011-06-05 Thread Etienne Kneuss
I consider this an improvement in terms of consistency w.r.t. callbacks, so +1 from me, good job! Best, On Sun, Jun 5, 2011 at 18:21, Felipe Pena wrote: > 2011/6/5 Benjamin Eberlei > >> That can lead to quite a bit of simplifications in code where you now have >> to check for is_array/is_callab

Re: [PHP-DEV] $arr = array('Hello', 'world'); $arr();

2011-06-05 Thread Felipe Pena
2011/6/5 Benjamin Eberlei > That can lead to quite a bit of simplifications in code where you now have > to check for is_array/is_callable/instanceof Closure and such. I like it. > > Exactly, and since our current $x = 'hello::world'; $x(); doesn't support method calls, the array one can help on

Re: [PHP-DEV] $arr = array('Hello', 'world'); $arr();

2011-06-05 Thread Benjamin Eberlei
That can lead to quite a bit of simplifications in code where you now have to check for is_array/is_callable/instanceof Closure and such. I like it. On Sun, 5 Jun 2011 12:52:45 -0300 Felipe Pena wrote: > Hi all, > Reading our bug tracker I noticed a good feature request [1] from 2009 which > po

[PHP-DEV] $arr = array('Hello', 'world'); $arr();

2011-06-05 Thread Felipe Pena
Hi all, Reading our bug tracker I noticed a good feature request [1] from 2009 which points to an interesting feature that I think makes sense for us, since we are now working with $f() using objects and strings, and the array('class', 'method') is an old known for call_user_func()-like functions.