On 19/09/12 18:56, Steve Clay wrote:
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.
Oops, good point!
Some other ideas:
$cb = (callable) $obj->bar;
Ah, but (callable) that won't work for global functions, since
(callable) is a cast, and if I try to do:
$cb= (callable) mysql_real_escape_string;
I'd actually try to access a constant named 'mysql_real_escape_string'
(bad!!)
$cb = callable $obj->bar;
$cb = callable::$obj->bar;
$cb = $obj->bar::callable;
Here's two other possibilities from me:
$cb = {mysql_real_escape_string};
$cb = &{mysql_real_escape_string};
Both are completely illegal just now, I think.
Steve
--
Andrew Faulds
http://ajf.me/
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php