Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:76313 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 13847 invoked from network); 2 Aug 2014 21:27:18 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 2 Aug 2014 21:27:18 -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 192.64.116.199 as permitted sender) X-PHP-List-Original-Sender: ajf@ajf.me X-Host-Fingerprint: 192.64.116.199 imap11-2.ox.privateemail.com Received: from [192.64.116.199] ([192.64.116.199:44414] helo=imap11-2.ox.privateemail.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 58/B0-02246-2B75DD35 for ; Sat, 02 Aug 2014 17:27:16 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.privateemail.com (Postfix) with ESMTP id 7FA8A880234; Sat, 2 Aug 2014 17:27:35 -0400 (EDT) X-Virus-Scanned: Debian amavisd-new at imap11.ox.privateemail.com Received: from mail.privateemail.com ([127.0.0.1]) by localhost (imap11.ox.privateemail.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id lcp34vu2RKOn; Sat, 2 Aug 2014 17:27:35 -0400 (EDT) Received: from [192.168.0.15] (unknown [90.210.122.167]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.privateemail.com (Postfix) with ESMTPSA id 5A4BD880182; Sat, 2 Aug 2014 17:27:34 -0400 (EDT) Content-Type: text/plain; charset=windows-1252 Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) In-Reply-To: Date: Sat, 2 Aug 2014 22:27:31 +0100 Cc: PHP internals Content-Transfer-Encoding: quoted-printable Message-ID: References: <3F1B2834-3939-4F86-86E0-207D2CE469D6@ajf.me> To: Nikita Popov X-Mailer: Apple Mail (2.1878.6) Subject: Re: [PHP-DEV] [RFC] Introduce Abstract Syntax Tree From: ajf@ajf.me (Andrea Faulds) Hi! On 2 Aug 2014, at 21:44, Nikita Popov wrote: > Why do you think this isn't a good idea? I think it would be a nice = way to prototype language features before pulling them into PHP. Though = admittedly I don't think there are many things that could be implemented = that way. If people can extend the syntax, they will, and I don=92t like the = possible consequences of that. I=92m all for overloading, but if people = start relying on custom syntactical features, it means non-portable and = confusing to read code. Granted, it might be useful for prototyping, but = prototyping itself would be easier with an AST, so I=92m not sure it = matters. > A native extension has the limitation that it will not be able to = parse files for newer PHP versions (which, depending on the use case may = or may not be a problem) and probably won't provide a stable structure = across versions. At least I think giving BC guarantees on the AST = structure between minor versions would be way too limiting for us. As = such I think both a native ext (which provides awesome perf) and = PHP-Parser (which provides x-compat) have their place ;) Yeah, I was thinking that you could keep it around for version = compatibility. You could even make your library pass through to the = native ext where possible. :) > Yes, the AST structure is based on the existing work on constant = scalar expressions, though by now the structure and API deviate a good = bit from that. It doesn't cause problems for them - constant expressions = go through a validation that checks that only valid nodes are used and = adjusts those nodes that have special representation for the constexpr = case (e.g. constant and class constant access) Ah, I see. -- Andrea Faulds http://ajf.me/