Re: [PHP-DEV] RFC: alternative callback syntax

2012-09-20 Thread Ivan Enderlin @ Hoa
On 20/09/12 10:17, Pierre Joye wrote: hi, On Thu, Sep 20, 2012 at 10:09 AM, Ivan Enderlin @ Hoa wrote: On 19/09/12 19:41, Steve Clay wrote: On 9/19/12 9:26 AM, Ivan Enderlin @ Hoa wrote: callable is already a reserved word (T_CALLABLE). Oh, good. It's not listed here http://php.net/manual/

Re: [PHP-DEV] RFC: alternative callback syntax

2012-09-20 Thread Pete Boere
Tentative +1 for the func_name::callable version. callable seems more generic, and possibly more intuitive when scan reading code that contains lots of 'function'. class A { static function init() { $inst = new self; var_export ($inst->bar::calla

Re: [PHP-DEV] RFC: alternative callback syntax

2012-09-20 Thread Adam Harvey
On 20 September 2012 16:24, Ivan Enderlin @ Hoa 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

Re: [PHP-DEV] RFC: alternative callback syntax

2012-09-20 Thread Ivan Enderlin @ Hoa
On 19/09/12 20: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';

Re: [PHP-DEV] RFC: alternative callback syntax

2012-09-20 Thread Pierre Joye
hi, On Thu, Sep 20, 2012 at 10:09 AM, Ivan Enderlin @ Hoa wrote: > On 19/09/12 19:41, Steve Clay wrote: >> >> On 9/19/12 9:26 AM, Ivan Enderlin @ Hoa wrote: >>> >>> callable is already a reserved word (T_CALLABLE). >> >> >> Oh, good. It's not listed here http://php.net/manual/en/tokens.php > > Ex

Re: [PHP-DEV] RFC: alternative callback syntax

2012-09-20 Thread Ivan Enderlin @ Hoa
On 19/09/12 19:41, Steve Clay wrote: On 9/19/12 9:26 AM, Ivan Enderlin @ Hoa wrote: callable is already a reserved word (T_CALLABLE). Oh, good. It's not listed here http://php.net/manual/en/tokens.php Exactly. Who is responsible to update the documentation? Julien? Best regards. -- Ivan End

Re: [PHP-DEV] RFC: alternative callback syntax

2012-09-19 Thread Andrew Faulds
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';

Re: [PHP-DEV] RFC: alternative callback syntax

2012-09-19 Thread Steve Clay
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, unexpec

Re: [PHP-DEV] RFC: alternative callback syntax

2012-09-19 Thread Andrew Faulds
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;

Re: [PHP-DEV] RFC: alternative callback syntax

2012-09-19 Thread Steve Clay
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

Re: [PHP-DEV] RFC: alternative callback syntax

2012-09-19 Thread Steve Clay
On 9/19/12 9:26 AM, Ivan Enderlin @ Hoa wrote: callable is already a reserved word (T_CALLABLE). Oh, good. It's not listed here http://php.net/manual/en/tokens.php Steve -- http://www.mrclay.org/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net

Re: [PHP-DEV] RFC: alternative callback syntax

2012-09-19 Thread Andrew Faulds
On 19/09/12 18:16, Levi Morrison wrote: On Tue, Sep 18, 2012 at 8:48 PM, Steve Clay wrote: Hello, https://wiki.php.net/rfc/alternative_callback_syntax is a proposal for a simple alternative syntax for creating function callbacks. The basics: Given a function/method call, replace the argument

Re: [PHP-DEV] RFC: alternative callback syntax

2012-09-19 Thread Levi Morrison
On Tue, Sep 18, 2012 at 8:48 PM, Steve Clay wrote: > > Hello, > > https://wiki.php.net/rfc/alternative_callback_syntax is a proposal for a > simple alternative syntax for creating function callbacks. > > The basics: Given a function/method call, replace the argument list with > "::function". PHP

Re: [PHP-DEV] RFC: alternative callback syntax

2012-09-19 Thread Ivan Enderlin @ Hoa
On 19/09/12 15:15, Steve Clay wrote: On 9/19/12 2:37 AM, Sebastian Krebs wrote: 2012/9/19 Steve Clay mailto:st...@mrclay.org>> https://wiki.php.net/rfc/__alternative_callback_syntax reason I like 'Classname::class' for classes) I don't like, that functions will look like classes with a sta

Re: [PHP-DEV] RFC: alternative callback syntax

2012-09-19 Thread Steve Clay
On 9/19/12 2:37 AM, Sebastian Krebs wrote: 2012/9/19 Steve Clay mailto:st...@mrclay.org>> https://wiki.php.net/rfc/__alternative_callback_syntax reason I like 'Classname::class' for classes) I don't like, that functions will look like classes with a static property "function" then ...

Re: [PHP-DEV] RFC: alternative callback syntax

2012-09-18 Thread Sebastian Krebs
2012/9/19 Steve Clay > Hello, > > https://wiki.php.net/rfc/**alternative_callback_syntaxis > a proposal for a simple alternative syntax for creating function > callbacks. > > The basics: Given a function/method call, replace the argument list