Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:53919 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 76655 invoked from network); 12 Jul 2011 14:18:14 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 12 Jul 2011 14:18:14 -0000 X-Host-Fingerprint: 96.2.18.191 host-191-18-2-96.midco.net Date: Tue, 12 Jul 2011 10:18:13 -0400 Received: from [96.2.18.191] ([96.2.18.191:12431] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 00/E0-01039-5A75C1E4 for ; Tue, 12 Jul 2011 10:18:13 -0400 Message-ID: <00.E0.01039.5A75C1E4@pb1.pair.com> To: internals@lists.php.net References: <1310460497.28120.25.camel@guybrush> User-Agent: slrn/pre1.0.0-18 (Linux) Mime-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit X-Posted-By: 96.2.18.191 Subject: Re: [PHP-DEV] Make primitive type names reserved words (Was: Re: [PHP-DEV] [RFC] 5.4 features for vote (long)) From: weierophinney@php.net (Matthew Weier O'Phinney) On 2011-07-12, Johannes Schlüter wrote: > On Sun, 2011-07-10 at 19:41 +0200, Nikita Popov wrote: > > E.g. Writing > > > > class Evaluator { > > public function eval() { > > > > } > > } > > > > Does in no way create an ambiguity with the eval language construct > > PHP implements. > > For a method this is correct. But for a normal function this is > different: > > function eval() { > } > eval(); // will call the language construct > ?> But what about this? namespace Foo { function eval($name) { echo $name; } eval('matthew'); } The manual doesn't really differentiate between language constructs and functions, and as such, I can see somebody reading the namespace section of the manual and feeling this should be valid -- but currently, it results in a parse error. It seems to me we need a context-sensitive lexer. > And i consider it "strange" to allow different names for functions and > methods. And yes I'm aware that > $eval = 'eval'; $eval(); > would call the function. > > I fear consistency issues. -- Matthew Weier O'Phinney Project Lead | matthew@zend.com Zend Framework | http://framework.zend.com/ PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc