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

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 ra

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 > wrote: > >>> Why would this imply "dropping" the object? > >>> > >>> This: > >>>    $foo = (new bar())->someSetter(); > >>> Looks a lot better than this > >>>    $foo = ne

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

2010-01-20 Thread Christian Grobmeier
On Wed, Jan 20, 2010 at 11:35 AM, Christian Grobmeier 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 kn

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 o

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 ki

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 wrote: >> Eddie Drapkin wrote: >>> On Tue, Jan 19, 2010 at 11:05 AM, Stanislav Malyshev wrote: The second was next on my list, while the first seems to me kind of exotic - why create object only to call one me

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

2010-01-19 Thread Eddie Drapkin
On Tue, Jan 19, 2010 at 12:02 PM, Rasmus Lerdorf wrote: > Eddie Drapkin wrote: >> On Tue, Jan 19, 2010 at 11:05 AM, Stanislav Malyshev 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

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

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

2010-01-19 Thread Eddie Drapkin
On Tue, Jan 19, 2010 at 11:05 AM, Stanislav Malyshev 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 object? This:

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

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

2010-01-19 Thread Arvids Godjuks
2010/1/19 Pierre Joye : > On Tue, Jan 19, 2010 at 12:31 PM, 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'd rather see two other things that are missing, support fo

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

2010-01-19 Thread Pierre Joye
On Tue, Jan 19, 2010 at 12:31 PM, 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'd rather see two other things that are missing, support for > dynamic object and array de-re