Re: [PHP-DEV] Re: function call chaining

2010-01-20 Thread Christian Grobmeier
On Wed, Jan 20, 2010 at 11:35 AM, Christian Grobmeier grobme...@gmail.com wrote: Why would this imply dropping the object? This:    $foo = (new bar())-someSetter(); Looks a lot better than this    $foo = new bar();    $foo-someSetter(); The second version is much clearer.  You know

Re: [PHP-DEV] Re: function call chaining

2010-01-20 Thread Alain Williams
On Wed, Jan 20, 2010 at 01:05:14PM +0100, Christian Grobmeier wrote: On Wed, Jan 20, 2010 at 11:35 AM, Christian Grobmeier grobme...@gmail.com wrote: Why would this imply dropping the object? This:    $foo = (new bar())-someSetter(); Looks a lot better than this    $foo = new bar();

Re: [PHP-DEV] Re: function call chaining

2010-01-20 Thread Christian Grobmeier
 I also think that:      $foo = (new bar())-someSetter(); someSetter() could return $this, although unlikely. The result of the line above would be that the bar object is garbage collected after being created method someSetter() invoked. To keep it one would have to do: In very rare

Re: [PHP-DEV] Re: function call chaining

2010-01-20 Thread Richard Lynch
On Tue, January 19, 2010 10:20 am, Eddie Drapkin wrote: On Tue, Jan 19, 2010 at 11:05 AM, Stanislav Malyshev s...@zend.com wrote: The second was next on my list, while the first seems to me kind of exotic - why create object only to call one method and immediately drop it? Why this method

[PHP-DEV] Re: function call chaining

2010-01-19 Thread Michael Wallner
On 01/19/2010 01:27 AM, Stanislav Malyshev wrote: Hi! I wrote a small patch that enables this kind of syntax in PHP: foo()(); I'd rather see two other things that are missing, support for dynamic object and array de-referencing like (new class)-method() and get_array()[index]. I honestly

Re: [PHP-DEV] Re: function call chaining

2010-01-19 Thread Pierre Joye
On Tue, Jan 19, 2010 at 12:31 PM, Michael Wallner m...@php.net wrote: On 01/19/2010 01:27 AM, Stanislav Malyshev wrote: Hi! I wrote a small patch that enables this kind of syntax in PHP: foo()(); I'd rather see two other things that are missing, support for dynamic object and array

Re: [PHP-DEV] Re: function call chaining

2010-01-19 Thread Arvids Godjuks
2010/1/19 Pierre Joye pierre@gmail.com: On Tue, Jan 19, 2010 at 12:31 PM, Michael Wallner m...@php.net wrote: On 01/19/2010 01:27 AM, Stanislav Malyshev wrote: Hi! I wrote a small patch that enables this kind of syntax in PHP: foo()(); I'd rather see two other things that are missing,

Re: [PHP-DEV] Re: function call chaining

2010-01-19 Thread Johannes Schlüter
Hi, On Tue, 2010-01-19 at 12:31 +0100, Michael Wallner wrote: On 01/19/2010 01:27 AM, Stanislav Malyshev wrote: Hi! I wrote a small patch that enables this kind of syntax in PHP: foo()(); I think that becomes hard to read quite easily. I'd rather see two other things that are

[PHP-DEV] Re: function call chaining

2010-01-19 Thread Clint Priest
I'd rather see two other things that are missing, support for dynamic object and array de-referencing like (new class)-method() and get_array()[index]. I honestly don't see func()()()() make anything better in the world of a PHP programmer. The array de-referencing and dynamic objects are much

Re: [PHP-DEV] Re: function call chaining

2010-01-19 Thread Stanislav Malyshev
Hi! I'd rather see two other things that are missing, support for dynamic object and array de-referencing like (new class)-method() and get_array()[index]. The second was next on my list, while the first seems to me kind of exotic - why create object only to call one method and immediately

Re: [PHP-DEV] Re: function call chaining

2010-01-19 Thread Eddie Drapkin
On Tue, Jan 19, 2010 at 11:05 AM, Stanislav Malyshev s...@zend.com wrote: The second was next on my list, while the first seems to me kind of exotic - why create object only to call one method and immediately drop it? Why this method is not static then? Why would this imply dropping the

Re: [PHP-DEV] Re: function call chaining

2010-01-19 Thread Rasmus Lerdorf
Eddie Drapkin wrote: On Tue, Jan 19, 2010 at 11:05 AM, Stanislav Malyshev s...@zend.com wrote: The second was next on my list, while the first seems to me kind of exotic - why create object only to call one method and immediately drop it? Why this method is not static then? Why would this

Re: [PHP-DEV] Re: function call chaining

2010-01-19 Thread Eddie Drapkin
On Tue, Jan 19, 2010 at 12:02 PM, Rasmus Lerdorf ras...@lerdorf.com wrote: Eddie Drapkin wrote: On Tue, Jan 19, 2010 at 11:05 AM, Stanislav Malyshev s...@zend.com wrote: The second was next on my list, while the first seems to me kind of exotic - why create object only to call one method and

Re: [PHP-DEV] Re: function call chaining

2010-01-19 Thread Rasmus Lerdorf
Eddie Drapkin wrote: On Tue, Jan 19, 2010 at 12:02 PM, Rasmus Lerdorf ras...@lerdorf.com wrote: Eddie Drapkin wrote: On Tue, Jan 19, 2010 at 11:05 AM, Stanislav Malyshev s...@zend.com wrote: The second was next on my list, while the first seems to me kind of exotic - why create object only

Re: [PHP-DEV] Re: function call chaining

2010-01-19 Thread Richard Lynch
On Tue, January 19, 2010 10:05 am, Stanislav Malyshev wrote: Hi! I'd rather see two other things that are missing, support for dynamic object and array de-referencing like (new class)-method() and get_array()[index]. The second was next on my list, while the first seems to me kind of

Re: [PHP-DEV] Re: function call chaining

2010-01-19 Thread Stanislav Malyshev
Hi! When I use one, I consider it exotic/obtuse/unusual enough to require self-documenting code, with a temp variable whose name include 'closure'. By use I meant not use it so rarely that it's an exotic hack for me that I have to explain what I did here, I mean write code that relies on