Re: RFC: alternative callback syntax

From: Date: Wed, 19 Sep 2012 17:56:28 +0000
Subject: Re: RFC: alternative callback syntax
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-63165@lists.php.net to get a copy of this message
On 9/19/12 1:19 PM, Andrew Faulds wrote:
I completely agree. How about &function_name? Resembles C (function pointers!), and unless I'm getting confused, it isn't currently legal syntax for something else.
$cb = & Foo::doSomething; $cb = & foo_doSomething; $cb = & $obj->doSomething; The last looks like a reference to a property, though having verb method names would help distinguish. Not sure if the ambiguity would make this difficult to implement. Some other ideas: $cb = (callable) $obj->bar; $cb = callable $obj->bar; $cb = callable::$obj->bar; $cb = $obj->bar::callable; Steve -- http://www.mrclay.org/

« previous php.internals (#63165) next »