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 also probably makes sense to add array deference chaining e.g. new Foo()[] (just for language consistency).

Thanks. Dmitry.

On 11/26/2010 10: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:

<?php

class bar {
   public $x = 'PHP';
}

class foo extends bar {
   public function bar() {
     return $this;
   }
}

var_dump(new foo()->bar()->x); // string(3) "PHP"

?>

Other examples which describes the feature at
http://wiki.php.net/rfc/instance-method-call

Thoughts?



--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to