Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:69110 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 93216 invoked from network); 12 Sep 2013 23:24:57 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 12 Sep 2013 23:24:57 -0000 Authentication-Results: pb1.pair.com header.from=bobwei9@hotmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=bobwei9@hotmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain hotmail.com designates 65.55.111.85 as permitted sender) X-PHP-List-Original-Sender: bobwei9@hotmail.com X-Host-Fingerprint: 65.55.111.85 blu0-omc2-s10.blu0.hotmail.com Windows 2000 SP4, XP SP1 Received: from [65.55.111.85] ([65.55.111.85:51058] helo=blu0-omc2-s10.blu0.hotmail.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id D8/33-09838-84D42325 for ; Thu, 12 Sep 2013 19:24:56 -0400 Received: from BLU0-SMTP412 ([65.55.111.71]) by blu0-omc2-s10.blu0.hotmail.com with Microsoft SMTPSVC(6.0.3790.4675); Thu, 12 Sep 2013 16:24:54 -0700 X-TMN: [sGr1m4DbbFVjBkK7G/Rn2o1ZZDZU1zE1] X-Originating-Email: [bobwei9@hotmail.com] Message-ID: Received: from [192.168.178.42] ([188.115.28.77]) by BLU0-SMTP412.phx.gbl over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Thu, 12 Sep 2013 16:24:51 -0700 Content-Type: text/plain; charset="iso-8859-1" MIME-Version: 1.0 (Mac OS X Mail 6.5 \(1508\)) In-Reply-To: <1379018669.12435.1710.camel@guybrush> Date: Fri, 13 Sep 2013 01:24:48 +0200 CC: Developers PHP Mailing List Content-Transfer-Encoding: quoted-printable References: <1379018669.12435.1710.camel@guybrush> To: =?iso-8859-1?Q?Johannes_Schl=FCter?= , Nikita Popov X-Mailer: Apple Mail (2.1508) X-OriginalArrivalTime: 12 Sep 2013 23:24:51.0878 (UTC) FILETIME=[47F85C60:01CEB00F] Subject: Re: [PHP-DEV] Support for keywords where possible From: bobwei9@hotmail.com (Bob Weinand) Am 12.9.2013 um 22:44 schrieb Johannes Schl=FCter = : > On Wed, 2013-09-11 at 23:21 +0200, Bob Weinand wrote: >> Hi! >>=20 >> 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. >=20 > I often stumbled over the annoyance of this limitation and I know many > users want it, I'm not convinced about adding it, though. >=20 > 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. Here is a concrete list when keywords are allowed: https://github.com/php/php-src/pull/438 Then you should have a better idea what exactly will be allowed in = future. Please go over the list and tell me explicitly what I should revert = there. > 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: >=20 > namespace network; > function if($which) { > // ... some logic ... > return "eth0"; > } > // ... somewhere else in the namespace ... > if($condition); > ?> >=20 > This can hide subtile typos or coding errors. Also look at currently > valid PHP code like this: >=20 > function while() {} > $condition =3D true; > while ($condition) > ?> >=20 > 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? >=20 > I'm sure one could construct other such cases. The "where (easily) possible" is exactly _not_ this. To call here the = function while you would have to write namespace\while(); (or call_user_func = etc.) I explicitly tried to not change the things where might be such = collisions. (That's what I meant with the "(easily) possible".) So this is basically a non-issue, I think, as it is highlighted that = it's a function and not a language construct by the need to prefix this. > 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. Yes, that is one of the main points. > 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. >=20 > 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 >=20 > johannes This sounds like some error while you were patching, because I cannot reproduce any such problem here. Bob Weinand=