Re: [PHP-DEV] [RFC] new foo()->bar()

2011-11-06 Thread Felipe Pena
2011/11/5 Stas Malyshev : > Hi! > > On 11/5/11 2:04 PM, Peter Cowburn wrote: >>> >>> Other examples which describes the feature at >>> http://wiki.php.net/rfc/instance-method-call >>> >>> Thoughts? >> >> Bump. >> >> What's the current status on this? >> >> It would be nice to  this teeny little pat

Re: [PHP-DEV] [RFC] new foo()->bar()

2011-11-05 Thread Laruence
+1 for this there is a little worried about that, is changing %%expect okey? (of course I am not talking about that rewrite all the rules then fix the r/s conflicts) thanks On Sun, Nov 6, 2011 at 9:01 AM, Stas Malyshev wrote: > Hi! > > On 11/5/11 2:04 PM, Peter Cowburn wrote: >>> >>> Other exa

Re: [PHP-DEV] [RFC] new foo()->bar()

2011-11-05 Thread Stas Malyshev
Hi! On 11/5/11 2:04 PM, Peter Cowburn wrote: Other examples which describes the feature at http://wiki.php.net/rfc/instance-method-call Thoughts? Bump. What's the current status on this? It would be nice to this teeny little patch in for 5.4.0 if possible. I think the brackets one is fin

Re: [PHP-DEV] [RFC] new foo()->bar()

2011-11-05 Thread Peter Cowburn
On 26 November 2010 19:36, Felipe Pena wrote: > Hi all, > I'm here again to presents another proposal, which adds support for > instantiating a class and calling its methods and accessing its properties > on same command. > > Example: > > > class bar { >  public $x = 'PHP'; > } > > class foo exte

Re: [PHP-DEV] [RFC] new foo()->bar()

2010-11-29 Thread Felipe Pena
2010/11/29 Felipe Pena > It also probably makes sense to add array deference chaining e.g. new >> Foo()[] (just for language consistency). >> >> > Hmm, looks good to me. :) > > I've updated the patch with the bracketed version to include the array dereferecing support: http://felipe.ath.cx/diff/

Re: [PHP-DEV] [RFC] new foo()->bar()

2010-11-29 Thread Julien Pauli
Care should be taken in the case of new myClass()->foo() just creates an object to call a method but a static method would be more efficient here. However, well used (fluent interface for exemple) make me think +1 for that patch. J.Pauli On Mon, Nov 29, 2010 at 12:40 PM, Felipe Pena wrote: > Hi

Re: [PHP-DEV] [RFC] new foo()->bar()

2010-11-29 Thread Felipe Pena
Hi Dmitry, 2010/11/29 Dmitry Stogov > Hi Felipe, > I'm wondered it works out of the box with so small patches :) > > However, both patches introduce new parser conflicts and it would be grate > to avoid them. > > I will check if there is any way to avoid it. > Also the patches need to be ch

Re: [PHP-DEV] [RFC] new foo()->bar()

2010-11-28 Thread Dmitry Stogov
Hi Felipe, I'm wondered it works out of the box with so small patches :) However, both patches introduce new parser conflicts and it would be grate to avoid them. Also the patches need to be checked for memory leaks in case of exceptions thrown from constructor and chained function(s). It

Re: [PHP-DEV] [RFC] new foo()->bar()

2010-11-28 Thread Adam Harvey
On 27 November 2010 03:36, Felipe Pena wrote: > I'm here again to presents another proposal, which adds support for > instantiating a class and calling its methods and accessing its properties > on same command. > > Thoughts? Great work, Felipe! +1 for the feature; my very weak preference would b

Re: [PHP-DEV] [RFC] new foo()->bar()

2010-11-27 Thread Felipe Pena
Hi, 2010/11/26 Felipe Pena > 2010/11/26 Johannes Schlüter > > On Fri, 2010-11-26 at 17:36 -0200, Felipe Pena wrote: >> > var_dump(new foo()->bar()->x); // string(3) "PHP" >> >> It has some readability issues. One might assume it is >> >>new (foo()->bar()->x) >> >> not >> >>(new foo())->

Re: [PHP-DEV] [RFC] new foo()->bar()

2010-11-26 Thread Peter Lind
On Friday, November 26, 2010, Gustavo Lopes wrote: > On Fri, 26 Nov 2010 20:25:32 -, Peter Lind wrote: > > > It seems fairly handy and I've been in situations where I wanted to do > something like that - in fact, I use factories to achieve something > similar. >  However, the more I use it, t

Re: [PHP-DEV] [RFC] new foo()->bar()

2010-11-26 Thread Pierre Joye
+1 :) On Fri, Nov 26, 2010 at 8:36 PM, Felipe Pena wrote: > Hi all, > I'm here again to presents another proposal, which adds support for > instantiating a class and calling its methods and accessing its properties > on same command. > > Example: > > > class bar { >  public $x = 'PHP'; > } > > c

Re: [PHP-DEV] [RFC] new foo()->bar()

2010-11-26 Thread Stas Malyshev
Hi! huge +1 from me ;-) It might be worth adding function call chaining with dereferencing and instance method call chaning, like $a = function(){ return function(){ echo 'Hello'; }; }; $a()(); See: http://wiki.php.net/rfc/fcallfcall -- Stanislav Malyshev, Software Architect SugarCRM: http://w

Re: [PHP-DEV] [RFC] new foo()->bar()

2010-11-26 Thread Kalle Sommer Nielsen
Hi Felipe 2010/11/26 Felipe Pena : > Other examples which describes the feature at > http://wiki.php.net/rfc/instance-method-call > > Thoughts? huge +1 from me ;-) It might be worth adding function call chaining with dereferencing and instance method call chaning, like $a = function(){ return fun

Re: [PHP-DEV] [RFC] new foo()->bar()

2010-11-26 Thread Pierrick Charron
+1 Good job felipe On 26 November 2010 14:36, Felipe Pena wrote: > Hi all, > I'm here again to presents another proposal, which adds support for > instantiating a class and calling its methods and accessing its properties > on same command. > > Example: > > > class bar { > public $x = 'PHP'; >

Re: [PHP-DEV] [RFC] new foo()->bar()

2010-11-26 Thread Adam Richardson
On Fri, Nov 26, 2010 at 2:36 PM, Felipe Pena wrote: > Hi all, > I'm here again to presents another proposal, which adds support for > instantiating a class and calling its methods and accessing its properties > on same command. > > Example: > > > class bar { > public $x = 'PHP'; > } > > class f

Re: [PHP-DEV] [RFC] new foo()->bar()

2010-11-26 Thread Peter Lind
On Friday, November 26, 2010, Gustavo Lopes wrote: > On Fri, 26 Nov 2010 20:25:32 -, Peter Lind wrote: > > > It seems fairly handy and I've been in situations where I wanted to do > something like that - in fact, I use factories to achieve something > similar. >  However, the more I use it, t

Re: [PHP-DEV] [RFC] new foo()->bar()

2010-11-26 Thread Gustavo Lopes
On Fri, 26 Nov 2010 20:25:32 -, Peter Lind wrote: It seems fairly handy and I've been in situations where I wanted to do something like that - in fact, I use factories to achieve something similar. However, the more I use it, the more it feels like introducing code smells into my code. Y

Re: [PHP-DEV] [RFC] new foo()->bar()

2010-11-26 Thread Bob Hensley
On 11/26/2010 2:36 PM, Felipe Pena wrote: Hi all, I'm here again to presents another proposal, which adds support for instantiating a class and calling its methods and accessing its properties on same command. Example: bar()->x); // string(3) "PHP" ?> Other examples which describes the featur

RE: [PHP-DEV] [RFC] new foo()->bar()

2010-11-26 Thread Mike Robinson
November-26-10 2:36 PM, Felipe Pena writes: > Hi all, > I'm here again to presents another proposal, which adds support for > instantiating a class and calling its methods and accessing its > properties on same command. > > Example: > > > class bar { > public $x = 'PHP'; > } > > class foo e

Re: [PHP-DEV] [RFC] new foo()->bar()

2010-11-26 Thread Ferenc Kovacs
On Fri, Nov 26, 2010 at 9:46 PM, Peter Lind wrote: > On 26 November 2010 21:37, Ferenc Kovacs wrote: > > > > > > On Fri, Nov 26, 2010 at 9:25 PM, Peter Lind > wrote: > >> > >> On 26 November 2010 20:36, Felipe Pena wrote: > >> > Hi all, > >> > I'm here again to presents another proposal, which

Re: [PHP-DEV] [RFC] new foo()->bar()

2010-11-26 Thread Felipe Pena
2010/11/26 Johannes Schlüter > On Fri, 2010-11-26 at 17:36 -0200, Felipe Pena wrote: > > var_dump(new foo()->bar()->x); // string(3) "PHP" > > It has some readability issues. One might assume it is > >new (foo()->bar()->x) > > not > >(new foo())->bar()->x > > As there is a mandatory space

Re: [PHP-DEV] [RFC] new foo()->bar()

2010-11-26 Thread Peter Lind
On 26 November 2010 21:37, Ferenc Kovacs wrote: > > > On Fri, Nov 26, 2010 at 9:25 PM, Peter Lind wrote: >> >> On 26 November 2010 20:36, Felipe Pena wrote: >> > Hi all, >> > I'm here again to presents another proposal, which adds support for >> > instantiating a class and calling its methods an

Re: [PHP-DEV] [RFC] new foo()->bar()

2010-11-26 Thread Ferenc Kovacs
On Fri, Nov 26, 2010 at 9:25 PM, Peter Lind wrote: > On 26 November 2010 20:36, Felipe Pena wrote: > > Hi all, > > I'm here again to presents another proposal, which adds support for > > instantiating a class and calling its methods and accessing its > properties > > on same command. > > > > Exa

Re: [PHP-DEV] [RFC] new foo()->bar()

2010-11-26 Thread Peter Lind
On 26 November 2010 20:36, Felipe Pena wrote: > Hi all, > I'm here again to presents another proposal, which adds support for > instantiating a class and calling its methods and accessing its properties > on same command. > > Example: > > > class bar { >  public $x = 'PHP'; > } > > class foo exte

Re: [PHP-DEV] [RFC] new foo()->bar()

2010-11-26 Thread Ferenc Kovacs
On Fri, Nov 26, 2010 at 8:36 PM, Felipe Pena wrote: > Hi all, > I'm here again to presents another proposal, which adds support for > instantiating a class and calling its methods and accessing its properties > on same command. > > Example: > > > class bar { > public $x = 'PHP'; > } > > class f

Re: [PHP-DEV] [RFC] new foo()->bar()

2010-11-26 Thread Johannes Schlüter
On Fri, 2010-11-26 at 17:36 -0200, Felipe Pena wrote: > var_dump(new foo()->bar()->x); // string(3) "PHP" It has some readability issues. One might assume it is new (foo()->bar()->x) not (new foo())->bar()->x As there is a mandatory space between "new" and its operand and no space in f

Re: [PHP-DEV] [RFC] new foo()->bar()

2010-11-26 Thread Daniel Brown
On Fri, Nov 26, 2010 at 14:36, Felipe Pena wrote: > Hi all, > I'm here again to presents another proposal, which adds support for > instantiating a class and calling its methods and accessing its properties > on same command. > > Example: > > > class bar { >  public $x = 'PHP'; > } > > class foo

Re: [PHP-DEV] [RFC] new foo()->bar()

2010-11-26 Thread Ilia Alshanetsky
+1 Seems like a handy change and the patch is quite manageable. On Fri, Nov 26, 2010 at 2:36 PM, Felipe Pena wrote: > Hi all, > I'm here again to presents another proposal, which adds support for > instantiating a class and calling its methods and accessing its properties > on same command. > >

[PHP-DEV] [RFC] new foo()->bar()

2010-11-26 Thread Felipe Pena
Hi all, I'm here again to presents another proposal, which adds support for instantiating a class and calling its methods and accessing its properties on same command. Example: bar()->x); // string(3) "PHP" ?> Other examples which describes the feature at http://wiki.php.net/rfc/instance-method