Re: Inconsistencies in callable, call_user_func and direct variable calls

From: Date: Thu, 19 Mar 2015 15:47:18 +0000
Subject: Re: Inconsistencies in callable, call_user_func and direct variable calls
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-85216@lists.php.net to get a copy of this message
I've always liked how callbacks (well, function pointers) are handled in C - using the function name without parentheses. eg. $a = $object->method; But this wouldn't work in PHP as is, since property and method names would collide. How do people feel about the fact that we have separate property and method namespaces? Does it add value? Vik On Thursday, 19 March 2015, 12:48, Sebastian B.-Hagensen <sbj.ml.read@gmail.com> wrote: Hi, 2015-03-19 12:51 GMT+01:00 Yasuo Ohgaki <yohgaki@ohgaki.net>: > Distinguishing array and callable is problematic. > Array callable is better to be deprecated in the long run. IMHO. Then how would you write an callback containing an already constructed object? $a = [$object, 'method']; The alternative is unnecessarily cumbersome: $a = function($methodArg1, $methodArg2) use($object) { return $object->method($methodArg1, $methodArg2); }; -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.internals (#85216) next »