Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:83105 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 14192 invoked from network); 18 Feb 2015 19:06:10 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Feb 2015 19:06:10 -0000 Authentication-Results: pb1.pair.com header.from=nikita.ppv@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=nikita.ppv@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.212.174 as permitted sender) X-PHP-List-Original-Sender: nikita.ppv@gmail.com X-Host-Fingerprint: 209.85.212.174 mail-wi0-f174.google.com Received: from [209.85.212.174] ([209.85.212.174:64283] helo=mail-wi0-f174.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id EF/74-25021-0A2E4E45 for ; Wed, 18 Feb 2015 14:06:09 -0500 Received: by mail-wi0-f174.google.com with SMTP id em10so43283673wid.1 for ; Wed, 18 Feb 2015 11:06:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=xVt0V2TAVNj3i9jhVCrbvid1X1fumXx6n3Di9boLeFo=; b=PU5D8zKELwsBtk3pB0sf1HgyX5nsIz81PjD5/T/7p7rUnDpSFNxzWeI5hWTeAsG3K/ JcraLrlk+tMWD5Lb48HMfuHekNlMXjXkqO/GzGcJVpKtECK/LRTqvmz6ySLTOCPysNz9 tjKDu/ASkIZRTOs2c3AtYbRGQLRrBsG4Utp/eybMjZWLUwTd76D7NQ2jP77TGVeSZJr5 Nq3D2D/0VoCmahsrGOC9N5XJopGqlgWsCjsOO/iadE5IfhIwDb+yTQzgMteHjmUUjox8 tjTrwava8cZwliouEZWY+edLrrVHL3qMK1YxsXC9Kju0a51psoAnyUEDbb/Xo/gFY42V ZLTw== MIME-Version: 1.0 X-Received: by 10.195.12.71 with SMTP id eo7mr1482621wjd.3.1424286364429; Wed, 18 Feb 2015 11:06:04 -0800 (PST) Received: by 10.27.10.168 with HTTP; Wed, 18 Feb 2015 11:06:04 -0800 (PST) In-Reply-To: References: Date: Wed, 18 Feb 2015 20:06:04 +0100 Message-ID: To: Alexander Lisachenko Cc: Dmitry Stogov , Nikita Popov , PHP internals list Content-Type: multipart/alternative; boundary=047d7bb04ee4cf7414050f6182e8 Subject: Re: [PHP-DEV] [RFC][Discussion] Parser extension API From: nikita.ppv@gmail.com (Nikita Popov) --047d7bb04ee4cf7414050f6182e8 Content-Type: text/plain; charset=UTF-8 On Wed, Feb 18, 2015 at 4:22 PM, Alexander Lisachenko < lisachenko.it@gmail.com> wrote: > > 2015-02-18 17:59 GMT+03:00 Nikita Popov : > >> Alexander, I would recommend you to split this into two RFCs, one dealing >> only with AST export (and maybe pretty printing) and the second one with >> the compilation hooks. There's probably a few questions about the export >> API that should be discussed that will be forgotten if everyone focuses on >> the more complicated, and probably not yet relevant, question of >> compilation hooks. > > > > Hello, Nikita! Thanks for you thoughts! > > Sounds reasonable for me, because of short timeframe for PHP7. Let's go > with the first part of RFC, because second part is really cumbersome and > can be applied later, eg. in 7.1 I will split this RFC into two parts and > mark first part for 7.0. > Great! About first part, do you agree with proposed classes and namespace > `Php\Parser`? > Yeah, I'm okay with that namespace. I prefer php\ast as being more distinctive from existing projects, but that's not really important. > I want to propose to use classes for parser API instead of pure functions > because it can give more usable OO-API for future needs. > I'm okay with having stuff like ->getKindName() on the nodes, however I'd still keep around the free-standing functions, because they can be used without a node (i.e. you only need the kind AST_FOO and not an instantiated node). I also don't see why we need ParserEngine::parse() instead of just a (namespaced) parse() function. Not a fan of unnecessary wrapper classes. > There is one more notice regarding to the zval nodes, they should be also > exported as objects, not as values. I think we should export coherent nodes > for everything. > What's the advantage of this? Most leaf nodes will be zval nodes and I feel it would be rather inconvenient if they'd all have extra wrappers. Is there some specific problem with including the values directly? Nikita --047d7bb04ee4cf7414050f6182e8--