Am 20.03.2007 um 15:24 schrieb Daniel Rozsnyo:

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.

I 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.


what about "lambda", like in Python?


David

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to