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)

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 Julien Pauli
+1 , nice job Julien On Mon, Jun 6, 2011 at 12:53 PM, David Zülke david.zue...@bitextender.com 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

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

2011-06-06 Thread Hannes Magnusson
On Sun, Jun 5, 2011 at 17:52, Felipe Pena felipe...@gmail.com 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

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

2011-06-06 Thread Matthew Weier O'Phinney
On 2011-06-06, Hannes Magnusson hannes.magnus...@gmail.com wrote: On Sun, Jun 5, 2011 at 17:52, Felipe Pena felipe...@gmail.com 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

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

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

2011-06-06 Thread Felipe Pena
Hi, 2011/6/6 Dmitry Stogov dmi...@zend.com 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) ==

[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.

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 felipe...@gmail.com wrote: Hi all, Reading our bug tracker I noticed a good feature request [1]

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

2011-06-05 Thread Felipe Pena
2011/6/5 Benjamin Eberlei kont...@beberlei.de 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

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 felipe...@gmail.com wrote: 2011/6/5 Benjamin Eberlei kont...@beberlei.de That can lead to quite a bit of simplifications in code where you now have

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 felipe...@gmail.com 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

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

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 Pierre Joye
On Sun, Jun 5, 2011 at 9:52 PM, Zeev Suraski z...@zend.com 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 supposed

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

2011-06-05 Thread Felipe Pena
Hi, 2011/6/5 Zeev Suraski z...@zend.com -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..? If

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 z...@zend.commailto:z...@zend.com -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

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

2011-06-05 Thread Felipe Pena
Hi, 2011/6/5 Stas Malyshev smalys...@sugarcrm.com 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

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

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

2011-06-05 Thread Felipe Pena
2011/6/5 Stas Malyshev smalys...@sugarcrm.com 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

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 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