Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:77762 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 92832 invoked from network); 3 Oct 2014 18:14:06 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Oct 2014 18:14:06 -0000 Authentication-Results: pb1.pair.com smtp.mail=pencap@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=pencap@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.213.178 as permitted sender) X-PHP-List-Original-Sender: pencap@gmail.com X-Host-Fingerprint: 209.85.213.178 mail-ig0-f178.google.com Received: from [209.85.213.178] ([209.85.213.178:59050] helo=mail-ig0-f178.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id C9/7E-10205-C67EE245 for ; Fri, 03 Oct 2014 14:14:05 -0400 Received: by mail-ig0-f178.google.com with SMTP id l13so3333422iga.11 for ; Fri, 03 Oct 2014 11:14:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=vsOADnKDqqIzmT39kbWE/1Xtn6WgV7MEdYN+kVsk4Y4=; b=PgXGOlLIvUE4HalM8JBkEIpdh9mZk1Wfn+xSS3ibzeE7p2FxCYtsQX1zmh3+LCfnXU Zj8pRmN5auRVVbwNagym0OFB9uhJkKUYyr1aH+F6zTbQxkfj3dgw0IxxcceA6QDJU4rE Trc7HUFwd67pFWJMCQhXqCpH/01c3IMCG9gG999bym8Wo9+jNXRy20cBU6Is7R75tJih lKVjGwqQBYPPjxATwRGvFFonbRtZpdOia0k07QYbdmRym4OCGRJWBIUJ4b9kEgXgw6Q4 kIydRTlzWhfN/aduIUnklrxA118jwckmsroHVFEfLKmwWXXZZtEFDu+oLEOpPuOJARdb PI8g== MIME-Version: 1.0 X-Received: by 10.50.114.38 with SMTP id jd6mr353257igb.26.1412360041812; Fri, 03 Oct 2014 11:14:01 -0700 (PDT) Received: by 10.50.85.230 with HTTP; Fri, 3 Oct 2014 11:14:01 -0700 (PDT) In-Reply-To: <9B6F1F10-7B1D-4FB0-A485-4F1C6202701C@googlemail.com> References: <42.58.10205.32DCE245@pb1.pair.com> <9B6F1F10-7B1D-4FB0-A485-4F1C6202701C@googlemail.com> Date: Fri, 3 Oct 2014 13:14:01 -0500 Message-ID: To: Ingwie Phoenix Cc: Levi Morrison , Thomas Gossmann , internals Content-Type: multipart/alternative; boundary=047d7b3a9598965803050488b20e Subject: Re: [PHP-DEV] [PHP7] Remove the function keyword from class methods? From: pencap@gmail.com (Mike Willbanks) --047d7b3a9598965803050488b20e Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Fri, Oct 3, 2014 at 12:57 PM, Ingwie Phoenix wrote: > > Am 03.10.2014 um 19:38 schrieb Levi Morrison : > > > On Fri, Oct 3, 2014 at 10:21 AM, Thomas Gossmann > > wrote: > > > >> Hey there, > >> > >> I'm just a php developer, thus not even having a php.net account. > >> > >> I was wondering if it is possible to deprecate/remove the function > keyword > >> from class methods in php7 or at least make it optional when one of th= e > >> visibility keywords is present? > >> > >> I feel like writing a completely unnecessary keyword each time I write= a > >> new method for a class. > >> > >> I guess this was a discussion earlier, though I wasn't able to find > >> anything about it. Would love to hear, what pdt-internals (re-)think > about > >> that topic. > >> > >> Thanks, > >> gossi > > > > > > Removing the function keyword makes it more difficult for people to fin= d > > method definitions. This has historically been a significant factor in > why > > this hasn't been done. > > > > Also, what does this change actually bring to the table? There is no > actual > > benefit to the language or tooling; in fact it probably makes the tooli= ng > > more difficult. All this means is that the user types the function > keyword > > less and saves a very, very small amount of time. > > > > In summary, historically we have felt that the benefits do not outweigh > the > > drawbacks. > > > I usually just observe on this list, but this is a topic I have come > across myself. > > PHP has followed the C++ syntax, and logical scoping like namespace,s > since a long time - if not, eversince. C++ does not use a function keywor= d > by itself, and even lesser visibility keywords as PHP does. > > I find it rather ugly seeing =E2=80=9Epublic function foo()=E2=80=9C ever= ywhere, when > everybody knows that parantheses mean function. So, I see readability as = a > plus. > > public bar($a, $b) { return $a+$b; } > } ?> > > It actually is not a drawback, but rather an enhancement that would > increase PHP=E2=80=99s readability, in my opinion. It could be introduced= as > =E2=80=9Esyntactic shuggar=E2=80=9C, where people can, but dont have to, = use the function > keyword. For the lexer, this just seems to be one more if(). > I do not really agree with this point, whilst it is possible and creates more concise structure, it changes a lot of things under the hoods... Looking for a method and uncertain of the visibility in grep, vim, etc? Have fun finding it... now you're doing expressions like /(public|protected|private)\s+methodName/. So while you saved typing in "function" which your WPS as a programmer is quite high. I doubt it is going to make much of a difference for you. > > I don=E2=80=99t see a lot of evolution in PHP lately, so something small = as this > might be pretty nice! :) > I don't think you have been watching closely enough, there has been a ton of evolutions lately... https://wiki.php.net/rfc#php_70 > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --047d7b3a9598965803050488b20e--