Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:69104 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 78856 invoked from network); 12 Sep 2013 20:44:44 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 12 Sep 2013 20:44:44 -0000 Authentication-Results: pb1.pair.com smtp.mail=johannes@schlueters.de; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=johannes@schlueters.de; sender-id=unknown Received-SPF: error (pb1.pair.com: domain schlueters.de from 217.114.215.10 cause and error) X-PHP-List-Original-Sender: johannes@schlueters.de X-Host-Fingerprint: 217.114.215.10 mail.experimentalworks.net Received: from [217.114.215.10] ([217.114.215.10:58027] helo=mail.experimentalworks.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 3C/70-09838-9B722325 for ; Thu, 12 Sep 2013 16:44:42 -0400 Received: from [192.168.2.20] (ppp-88-217-81-147.dynamic.mnet-online.de [88.217.81.147]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: johannes@schlueters.de) by mail.experimentalworks.net (Postfix) with ESMTPSA id 6158E4283C; Thu, 12 Sep 2013 22:44:44 +0200 (CEST) To: Bob Weinand Cc: Developers List PHP Mailing In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Date: Thu, 12 Sep 2013 22:44:29 +0200 Message-ID: <1379018669.12435.1710.camel@guybrush> Mime-Version: 1.0 X-Mailer: Evolution 2.30.3 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Support for keywords where possible From: johannes@schlueters.de (Johannes =?ISO-8859-1?Q?Schl=FCter?=) On Wed, 2013-09-11 at 23:21 +0200, Bob Weinand wrote: > Hi! > > I tried to widen the naming possibilities by allowing to use keywords > as identifiers (for function names, class names, label (goto) > names, ...) where possible. It doesn't break any BC. I often stumbled over the annoyance of this limitation and I know many users want it, I'm not convinced about adding it, though. One reason is the "where (easily) possible" part. Right now we have a simple rule "keywords can't be reused". This is being changed to "this and that keyword can be used her and there." I don't believe this is good. Secondly I'm among the people who read tons of "bad" code and I'm sure people will abuse this and we will find code like this: This can hide subtile typos or coding errors. Also look at currently valid PHP code like this: and while reading this mind that an ; in front of an ?> is optional, so will this call a function and exit or be stuck in an infinite loop? I'm sure one could construct other such cases. I'm more open about allowing such identifiers as method names only, as those are prefixed in some way ($object-> or someClass:: ) but even there I tend to consider the consistency between function and method names more important than this flexibility. I couldn't test those examples as your branch for some reason didn't work, even though I made sure I regenerated the parser, but I didn't look deeper, maybe my fault. 001+ Parse error: syntax error, unexpected 'catch' (T_CATCH), expecting identifier (T_STRING) or \\ (T_NS_SEPARATOR) or '{' in /.../Zend/tests/identifier_or_keyword_001.php on line 3 001- Ok 002- Fatal error: %s in %s on line %d johannes