"Andrea Faulds"  wrote in message news:19.45.38491.677d4...@pb1.pair.com...

Hi David,

David Rodrigues wrote:
Hello folks!
I just not understand why "function" should be abbreviated. It's about "how
less character better"? I don't see it too much on PHP. I guess that is
more simple keep what exists current "function", that all knows about (that
should be better than the next example):

$mapped = array_map(function($x) => $x + $y); // vs current:
$mapped = array_map(function($x) use($y) { return $x + $y });

I feel the same way. It would be nice to have shorter syntax, but it sacrifices readability and familiarity here, and adds yet another new keyword.

It also feels inconsistent… isn't "fn" just short for "function"? Why is it exclusive to the => syntax?

Thanks.

If something can already be done in PHP then why the rush to complicate the language so that the same thing can be accomplished with slightly fewer keystrokes? The idea that you should reduce 'function' to 'fn' just to save 6 keystrokes strikes me as ludicrous. It also breaks one of the fundamental rules of programming which is "Programs must be written for people to read, and only incidentally for machines to execute."

Replacing proper words with TLAs or even symbols will make the language less readable. It will also make it difficult for someone to spot a piece of unusual code and look it up in the manual to find out what it means. Those who want a language with hieroglyphic syntax should go back to Perl, but please leave PHP alone!

Anybody who is in favour of such a bad move deserves to have their keyboard confiscated and to be sent to bed without any supper.

--
Tony Marston


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

Reply via email to