Re: PATCH: anonymous functions in PHP
| From: | David Zülke | Date: | Tue, 20 Mar 2007 22:40:02 +0000 |
| Subject: | Re: PATCH: anonymous functions in PHP | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-28501@lists.php.net to get a copy of this message | ||
Am 20.03.2007 um 15:24 schrieb Daniel Rozsnyo:
what about "lambda", like in Python? DavidI don't have anything against 'function', I think JS uses the same syntax - function without a name. If you change it to something different, e.g 'callback', then you loose the information that it is actually a function $error_func = callback($msg) { file_put_contents('php://stderr',"Error: $msg\n"); } vs. $error_func = function($msg) { file_put_contents('php://stderr',"Error: $msg\n"); } The second one looks better for me.A function with a name is no longer anonymous ;)I am not suggesting that there be a name. I am suggesting that the reserved keyword for an anonymous function should not be 'function', the same as a normal function.