Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:50718 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 10372 invoked from network); 30 Nov 2010 09:59:51 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 30 Nov 2010 09:59:51 -0000 Authentication-Results: pb1.pair.com header.from=peter@lvp-media.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=peter@lvp-media.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain lvp-media.com from 209.85.216.170 cause and error) X-PHP-List-Original-Sender: peter@lvp-media.com X-Host-Fingerprint: 209.85.216.170 mail-qy0-f170.google.com Received: from [209.85.216.170] ([209.85.216.170:37706] helo=mail-qy0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 96/65-01713-61BC4FC4 for ; Tue, 30 Nov 2010 04:59:51 -0500 Received: by qyk10 with SMTP id 10so975247qyk.8 for ; Tue, 30 Nov 2010 01:59:48 -0800 (PST) MIME-Version: 1.0 Received: by 10.224.19.130 with SMTP id a2mr2584492qab.33.1291111187476; Tue, 30 Nov 2010 01:59:47 -0800 (PST) Received: by 10.220.19.200 with HTTP; Tue, 30 Nov 2010 01:59:47 -0800 (PST) In-Reply-To: <1290879624.7033.826.camel@guybrush> References: <1290879624.7033.826.camel@guybrush> Date: Tue, 30 Nov 2010 10:59:47 +0100 Message-ID: To: =?ISO-8859-1?Q?Johannes_Schl=FCter?= Cc: PHP internals list Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] RFC: Making T_FUNCTION optional in method declarations From: peter@lvp-media.com (Peter Beverloo) 2010/11/27 Johannes Schl=FCter > > Hi, > > every now and then while writing classes I forget to add the "function" > keyword between my visibility modifier and the method name in a class > declaration. I don't think it is required for readability and it is not > needed by the parser to prevent conflicts, I therefore propose the > following RFC incl. patch to allow writing > > =A0 =A0 =A0 =A0class Foo { > =A0 =A0 =A0 =A0 =A0 =A0public bar() { > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0echo "Hello World"; > =A0 =A0 =A0 =A0 =A0 =A0} > =A0 =A0 =A0 =A0} > > Without T_FUNCTION token. In my opinion an access modifier /public, > private protected, static, final) should still be required for keeping > readability. > > RFC: http://wiki.php.net/rfc/optional-t-function > Patch: http://schlueters.de/~johannes/php/zend_optional_t_function.diff > > johannes > > > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > Considering variables are prefixed and constants don't have visibility modifiers, functions in classes would still be easily recognizable. Syntax analyzing IDEs generally don't rely on single keywords and will be able to adapt a change like this without too much hassle. On top of that, seeing that functions in classes are generally referred to as methods, I believe removing the requirement would improve consistency. +1 from me. Kind regards, Peter Beverloo