Re: RFC: alternative callback syntax

From: Date: Wed, 19 Sep 2012 18:23:01 +0000
Subject: Re: RFC: alternative callback syntax
References: 1 2 3 4 5 6  Groups: php.internals 
Request: Send a blank email to internals+get-63170@lists.php.net to get a copy of this message
On 19/09/12 19:21, Steve Clay wrote:
On 9/19/12 2:01 PM, Andrew Faulds wrote:
Some other ideas: $cb = (callable) $obj->bar;
Ah, but (callable) that won't work for global functions, since (callable) is a cast, and
(callable) is not usable as a cast (at least in 5.4.7): $a = (callable)'str'; // Parse error: syntax error, unexpected 'callable' (T_CALLABLE) This could work, and it makes sense to me at least. Yes, the problem is that it would add a special syntax case, where (cast)identifier, in this case, uses a function name, not an expression. This is bad.
-- Andrew Faulds http://ajf.me/

« previous php.internals (#63170) next »