On 20 September 2012 16:24, Ivan Enderlin @ Hoa
<ivan.ender...@hoa-project.net> wrote:
>
>> On 9/19/12 2:01 PM, Andrew Faulds wrote:
>>> $cb = {mysql_real_escape_string};
>>> $cb = &{mysql_real_escape_string};
>
> These notations are just horrible.

Agreed. They're very line noisey and non-obvious.

> PHP has recently introduced ::class to resolve a classname (namespace Foo;
> A::class // Foo\A). The “::” was originally a resolution operator for calls,
> but now, it is also used for names (which sounds good for me). Here, you
> propose the new notation ::function, which can be understood as: “resolve
> this function or method as a callable”. We stay in a resolution context. It
> is consistent regarding to the evolution of this operator.

I like ::callable, personally, since it suggests the resulting type,
but ::function would also be OK by me.

> Another consistent notation is the cast: (callable) $obj->bar;.

I think the analogy with ::class is stronger than the analogy with
type casting (since it's not a variable or literal), although I'm not
really too fussed either way.

In terms of the feature itself (since I haven't weighed in yet), I
think it's a reasonable piece of syntactic sugar, although I'd
definitely want to see a patch before voting. :)

Adam

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


Reply via email to