In terms of thinking about typos, I'm sure there would be a solution to
making pretty robust short hand lambdas.
I think a more valid discussion would be whether PHP should have a short
hand lamda notation. A lot of talk on here is against there even being a
short-hand version, whatever syntax it is.
I'm really trying to continue the discussion in to coming up with a good
syntax everyone likes. If there is a good syntax maybe people against
the idea might change their opinion.
Personally I think it would be a good addition to the language. As other
people have pointed out, a lot of common languages have a syntax for
short hand lambdas. Also with the popularity of technologies such as
LinQ increasing, I can see small lambdas becoming more and more common.
In regards to typos, I don't think the following bit of code would be
too easy to put a typo in to?:
// Mapping:
$a->select( :($x)=> $x->getName() );
On 04/08/2011 21:20, Sebastian Krebs wrote:
Just two examples, why I think, this is a not a good idea. Simple
typos can produce hard to track errors. Its just confusing
$x = 4;
$y = ($x);{
return $x*2;
}
// and
$x = 4;
$x = ($x)
{
$y = $x*2;
}
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php