Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:62747 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 84746 invoked from network); 3 Sep 2012 15:19:35 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Sep 2012 15:19:35 -0000 Authentication-Results: pb1.pair.com header.from=ajf@ajf.me; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=ajf@ajf.me; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain ajf.me designates 64.22.89.134 as permitted sender) X-PHP-List-Original-Sender: ajf@ajf.me X-Host-Fingerprint: 64.22.89.134 oxmail.registrar-servers.com Received: from [64.22.89.134] ([64.22.89.134:57784] helo=oxmail.registrar-servers.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 10/BC-20751-58AC4405 for ; Mon, 03 Sep 2012 11:19:33 -0400 Received: from [192.168.0.200] (5ad3285b.bb.sky.com [90.211.40.91]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by oxmail.registrar-servers.com (Postfix) with ESMTPSA id 8D1C3F002E; Mon, 3 Sep 2012 11:19:29 -0400 (EDT) Message-ID: <5044CA5C.9080208@ajf.me> Date: Mon, 03 Sep 2012 16:18:52 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120714 Thunderbird/14.0 MIME-Version: 1.0 To: ivan.enderlin@hoa-project.net CC: internals@lists.php.net References: <5044C3E6.8040202@hoa-project.net> In-Reply-To: <5044C3E6.8040202@hoa-project.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] $obj->attr::method() is not allowed From: ajf@ajf.me (Andrew Faulds) On 03/09/12 15:51, Ivan Enderlin @ Hoa wrote: > > I would like to know why? Is it a compiler related issue or just an > omission? Would it be interesting to fix it? > There are plenty of examples of this. One from my code: Can't do this: self::$views[$path](); But I *can* do this: $x = self::$views[$path]; $x(); This is because PHP has a very unusual (and IMO bad) system of type-checking at parse-time, by only allowing some specific (although quite varied) types of variable access, and combinations of these. If nikic's idea to rewrite the parser to use an AST is done, I imagine this could be fixed. We could also add extra rules, but I think fixing the general issue is more important, since it's like plugging two holes in a barrel full of water that's just had a machine gun fired at it. -- Andrew Faulds http://ajf.me/