Re: [RFC][VOTE] Closure from callable
| From: | Dmitry Stogov | Date: | Mon, 16 May 2016 08:31:22 +0000 |
| Subject: | Re: [RFC][VOTE] Closure from callable | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-93349@lists.php.net to get a copy of this message | ||
I'm sorry, I didn't follow the RFC discussion.
In general I like the idea, but why not to use Closure constructor?
$f = new Closure("some_func");
would look more readable than
$f = Closure::fromCallable("some_func");
Sorry, if this was already discussed before.
Thanks. Dmitry.
________________________________________
From: Dan Ackroyd <danack@basereality.com>
Sent: Sunday, May 15, 2016 8:29:22 PM
To: internals@lists.php.net
Subject: [PHP-DEV] [RFC][VOTE] Closure from callable
Hello,
I've opened the voting for the Closure from callable RFC -
https://wiki.php.net/rfc/closurefromcallable
Just to note, some people I've spoken to have expressed a desire to
have a more powerful syntax where 'bare' function names are used,
like:
callable(someFunctionName)
callable($this->method)
I fully agree with those people, however I can't see anyway to do that
before PHP 8. It would almost certainly need some clean up of the
allowed syntax to disambiguate what
$this->method means for:
class Foo {
public $method;
public function method() { }
}
Leaving that top-level function name available for future versions,
where we might be able to support it properly, is one of the reasons
to use the more verbose function name.
cheers
Dan
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php