Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:66047 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 79989 invoked from network); 20 Feb 2013 10:26:09 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Feb 2013 10:26:09 -0000 Authentication-Results: pb1.pair.com header.from=florinpatan@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=florinpatan@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.214.169 as permitted sender) X-PHP-List-Original-Sender: florinpatan@gmail.com X-Host-Fingerprint: 209.85.214.169 mail-ob0-f169.google.com Received: from [209.85.214.169] ([209.85.214.169:44774] helo=mail-ob0-f169.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F9/AB-19387-FB4A4215 for ; Wed, 20 Feb 2013 05:26:08 -0500 Received: by mail-ob0-f169.google.com with SMTP id ta14so7642909obb.14 for ; Wed, 20 Feb 2013 02:26:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:mime-version:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=UrFnF5uZnXxpkMCIRTCEtUNiYdF4AfE+sgS6iVotXnI=; b=XHRwGxXqmBmgJVGgI/AO1BygPsy9aiDHXXTLFL+EIakI5r4A3m9AHaX3e19obdXrHN 2AcMHat00HplXdo6beuw4viyuTXkqnFAvEZBPk/Z+4u9hF8RA9pZNUEI7xnIqQ7MNqeh reSUiq6ayblYFd5PndtdpGPq7Cyp2fx2pnjcMXNRJWm+F1oJ4pU/iYnvfXdz/yQbpvvY DDIe2mof0wElR1P94WjozI7UmgGRErElYu+7emlI/lGj7NuhQZ7SwZBA4eOIKOjjIaFO rw/xTrZ/Y5Kklv8acn1DqUuWe7ZQfsH2oqG+Nv1lr2Xy11OVoGZil1P+6aDa5HGiUTNj BybA== X-Received: by 10.60.7.97 with SMTP id i1mr9185312oea.89.1361355964522; Wed, 20 Feb 2013 02:26:04 -0800 (PST) MIME-Version: 1.0 Received: by 10.76.169.3 with HTTP; Wed, 20 Feb 2013 02:25:34 -0800 (PST) In-Reply-To: <146974008.20130220045951@cypressintegrated.com> References: <-1452447624906595030@unknownmsgid> <51240F9D.8020409@lerdorf.com> <591203797.20130219192444@cypressintegrated.com> <4995898.20130220030236@cypressintegrated.com> <146974008.20130220045951@cypressintegrated.com> Date: Wed, 20 Feb 2013 12:25:34 +0200 Message-ID: To: Sanford Whiteman Cc: Nikita Nefedov Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] Dropping requirement for `function` keyword for methods in classes/interfaces/etc From: florinpatan@gmail.com (Florin Razvan Patan) Sandy, On Wed, Feb 20, 2013 at 11:59 AM, Sanford Whiteman wrote: >> Classes always should be declared with class keyword, because there could >> be ambiguity whether it's class, interface or trait. > > If only inner classes are allowed in a given PHP version, there's no > ambiguity about whether "something{}" just inside a a class is an > inner class. > > That's the justification for removing "function" just inside classes, > isn't it? That it's not ambiguous because the only thing as of PHP.now > that can take the form "sometype somevisibility something(){}" is a > function? > > Well, if in PHP.later, the only thing that takes the form "sometype > something{}" is an inner class, then leaving off the "sometype" there > is also unambiguous (but also similarly gratuitous). > > And if in PHP.later.still you have inner interfaces, then the > unmodified one still defaults to inner class and only a literal > "interface something{}" is an inner intf. > > (I'm attempting a RAA argument but maybe failing....) > > -- Sandy | FigureOne Support Team > I think you've abstracted this one way too much. For me right now all I see is a useless keyword in a class. We don't have 'visbilitytype var/property $varName' right now but you are comfortable with them knowing that they are just properties of the class. If I were to be on this road I could in fact argue that currently we have a lack of consistency between class methods and properties. You can have a look on this image if you want an example: http://i.imgur.com/Q0ZOZns.png For the part where public is optional, I think that most frameworks and practices they promote and users actually do type the keyword and have it there for the sake of consistency. It might not be the case for now, but I think that it would rather be useful to enforce the visibility types rather that the 'function' keyword. As for classes/interfaces/traits and so on, if they are ever added in PHP to be declared inside classes and so on then I see no issues with this. A class/interface or a trait keyword would still be needed to make the difference between a them imho. Grepping for sources is like a daily operation and by using IDEs like Netbeans/Eclipse/PHPStorm one has the ability to just search for a symbol directly, regardless if you can click of function name or not. No voting karma here as well but I do tons of code reviews and this is just my opinion, you know, from the userland. Regards. ---- Florin Patan https://github.com/dlsniper