On 4 October 2015 at 23:02, Stanislav Malyshev <smalys...@gmail.com> wrote: > Hi! > > That being said, I'm not sure how much need is for this - i.e. you can > always make a closure by just doing function() { return $this->blah(); } > if you need it.
As I said before (and as the RFC says), there are ways to work around not having it. But having to duplicate code and keep it in sync is a pain and indicates that something is missing from the language. > And if we're into performance optimization We're not. The performance stuff is nice side benefit, but it's not the main aim of the RFC which is to make life easier for people who want to create closures in PHP. > But the bigger question would be why you need more > specific type (Closure) instead of more generic (callable) IMO it's actually the other way round; closures are more generic than callables. To get the parameters of a closure via inspection you only ever need to use ReflectionFunction. To get the parameters of a callable, you need to figure out first what type of callable it is, and then either use ReflectionFunction or ReflectionClass + ReflectionMethod as appropriate. And also callables are just a bit insane currently: > Maybe we should fix $callable() then? :) Maybe we should! I announced a draft RFC a week ago: http://news.php.net/php.internals/88545 Only one person (off list) has given any feedback on it so far. I invite more feedback! Even if it's just "that's an amazing RFC Dan, you've covered every possible aspect of the changes that need to be discussed." that would still be good feedback to get. But as that RFC could only be introduced for PHP 8 at the earliest, and callable still won't be as easy to work with as closures, the feedback I have received is that people would very much appreciate having this RFC for 7.1 cheers Dan -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php