Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:98205 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 81339 invoked from network); 5 Feb 2017 10:03:14 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Feb 2017 10:03:14 -0000 X-Host-Fingerprint: 87.75.96.78 static-87-75-96-78.vodafonexdsl.co.uk Received: from [87.75.96.78] ([87.75.96.78:10620] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 9A/3D-38491-168F6985 for ; Sun, 05 Feb 2017 05:03:13 -0500 Message-ID: <9A.3D.38491.168F6985@pb1.pair.com> To: internals@lists.php.net References: <19.45.38491.677D4985@pb1.pair.com> In-Reply-To: <19.45.38491.677D4985@pb1.pair.com> Date: Sun, 5 Feb 2017 10:03:09 -0000 Lines: 1 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="utf-8"; reply-type=response Content-Transfer-Encoding: 8bit X-Priority: 3 X-MSMail-Priority: Normal Importance: Normal X-Newsreader: Microsoft Windows Live Mail 16.4.3564.1216 X-MimeOLE: Produced By Microsoft MimeOLE V16.4.3564.1216 X-Posted-By: 87.75.96.78 Subject: Re: [PHP-DEV] Re: [RFC][Discuss] Arrow Functions From: TonyMarston@hotmail.com ("Tony Marston") "Andrea Faulds" wrote in message news:19.45.38491.677D4985@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