Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:62748 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 86080 invoked from network); 3 Sep 2012 15:21:02 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Sep 2012 15:21:02 -0000 Authentication-Results: pb1.pair.com smtp.mail=ivan.enderlin@hoa-project.net; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=ivan.enderlin@hoa-project.net; sender-id=unknown Received-SPF: error (pb1.pair.com: domain hoa-project.net from 95.130.12.24 cause and error) X-PHP-List-Original-Sender: ivan.enderlin@hoa-project.net X-Host-Fingerprint: 95.130.12.24 host1.trois-doubles.net Linux 2.6 Received: from [95.130.12.24] ([95.130.12.24:38999] helo=host1.trois-doubles.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 60/0D-20751-CDAC4405 for ; Mon, 03 Sep 2012 11:21:01 -0400 Received: from Hwhost2.local (4-106.203-62.cust.bluewin.ch [62.203.106.4]) by host1.trois-doubles.net (Postfix) with ESMTPA id C617D2093AD; Mon, 3 Sep 2012 17:20:56 +0200 (CEST) Message-ID: <5044CAD8.8050600@hoa-project.net> Date: Mon, 03 Sep 2012 17:20:56 +0200 Reply-To: ivan.enderlin@hoa-project.net User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:17.0) Gecko/17.0 Thunderbird/17.0a2 MIME-Version: 1.0 To: Andrew Faulds CC: internals@lists.php.net References: <5044C3E6.8040202@hoa-project.net> <5044CA5C.9080208@ajf.me> In-Reply-To: <5044CA5C.9080208@ajf.me> 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: ivan.enderlin@hoa-project.net ("Ivan Enderlin @ Hoa") On 03/09/12 17:18, Andrew Faulds wrote: > 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. Absolutely. PHP has no AST? Why? For historical reasons? -- Ivan Enderlin Developer of Hoa http://hoa.42/ or http://hoa-project.net/ PhD. student at DISC/Femto-ST (Vesontio) and INRIA (Cassis) http://disc.univ-fcomte.fr/ and http://www.inria.fr/ Member of HTML and WebApps Working Group of W3C http://w3.org/