Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:84281 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 47556 invoked from network); 4 Mar 2015 08:52:19 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 Mar 2015 08:52:19 -0000 Authentication-Results: pb1.pair.com smtp.mail=nikita.ppv@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=nikita.ppv@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.212.181 as permitted sender) X-PHP-List-Original-Sender: nikita.ppv@gmail.com X-Host-Fingerprint: 209.85.212.181 mail-wi0-f181.google.com Received: from [209.85.212.181] ([209.85.212.181:45723] helo=mail-wi0-f181.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 56/A3-22753-2C7C6F45 for ; Wed, 04 Mar 2015 03:52:19 -0500 Received: by wivz2 with SMTP id z2so9342818wiv.4 for ; Wed, 04 Mar 2015 00:52:15 -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=pTo0zNLl7otneYPWsAgozGZRcrcQLeStZMxhu+qh0tk=; b=Uz/0iB9QCWkkj124t3dBVDtgY8tcSfbuC7Co05xHPSDqWwGm1z3UWLE5GS7Z+SvrPr DEYUHBLO3tlkLaT7AOHZ50rezrHULGpPWEJyFpVqsqxZ/WusxtiOE97TCLBvZ+uXDPfx 2Vaw9Z0FoaR3P6AOCR7KOn9Q0DQEzfTiPiM9JySfEt1tElLBro5T3YPXDK/oS42pyHzY s9zO2ynfbmVzIoGfwPSHkPgzaFFtHoD2UxJ0FPnxcKMorO8bMjpToDqAhMdjC1YPDTHX mzVXKEeq7wDq9ebZ0EE+1QS114N81HHhl9FH0dqScn0/kW0uWsjsPFCyMB0G43BgjrLB RmpA== MIME-Version: 1.0 X-Received: by 10.194.71.175 with SMTP id w15mr5736841wju.16.1425459135466; Wed, 04 Mar 2015 00:52:15 -0800 (PST) Received: by 10.27.10.168 with HTTP; Wed, 4 Mar 2015 00:52:15 -0800 (PST) In-Reply-To: References: Date: Wed, 4 Mar 2015 09:52:15 +0100 Message-ID: To: marcio3w@gmail.com Cc: PHP internals Content-Type: multipart/alternative; boundary=047d7bfcf00069515405107291fe Subject: Re: [PHP-DEV][RFC][VOTING] Context Sensitive Lexer From: nikita.ppv@gmail.com (Nikita Popov) --047d7bfcf00069515405107291fe Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Sun, Mar 1, 2015 at 2:11 AM, Marcio Almada wrote= : > Hi, > > Since no more issues appeared on discussion, the voting for the "Context > Sensitive Lexer" is now open. The voting will close in exactly 14 days > counting from now: > > RFC: https://wiki.php.net/rfc/context_sensitive_lexer#votes > > Since so few people participated on discussions, if you decide to vote "n= o" > please share your motives on the mailing lists by replying to this thread= . > This will collaborate to the RFC process and can lead to improvements on > possible follow up RFCs. > > Acknowledgments to Bob Weinand for all the advice and cooperation. > > Thanks, > M=C3=A1rcio. After reviewing the implementation, I've decided to vote "no" on this RFC. I had originally assumed that if this proposal is limited to method names and class constants only the implementation should be pretty simple and robust. However it turned out that there are a number of complications, the two primary ones being: a) We allow to define multiple class constants in one declaration. I.e. you can write not only const FOO =3D 42; but also const FOO =3D 42, BAR =3D 24, BAZ =3D 0; This is further complicated by the fact that we allow many types of (static scalar) expressions to be used as values for constants, so a declaration might actually look like const FOO =3D 42, BAR =3D [24, BAZ]; as well. b) The trait adaptations syntax allows using method names without a generic prefix like "::" or "->" in a number of ways. E.g. in use A { A::foo as bar; } foo and bar are method names. On the other hand in use A { A::foo as public; } the "public" is not a method name, it is used for trait method visibility aliasing. Trait aliasing (but not precedence!) adaptations also allow non-absolute method references on the left hand side, so use A { foo as bar; } without the leading A:: is possible as well. In order to support these kinds of things, the lexer has to track a bunch of state (e.g. to know if we're currently in a trait adaptation list as opposed to a namespace or closure "use" list) and also make extensive use of lexer lookahead. We also have to accurately track nesting of braces, which is easy to get wrong when considering details like string interpolation syntax. After a number of issues was fixed by Marcio, the patch still contains a few lexer rules that I don't really understand, but which seem to be required to avoid regressions in some edge case. So, tl;dr: I think the patch is too risky. Even if we can make sure that we've covered all the current edge-cases and don't regress anything, I'm afraid that this will cause complications with future changes. This ends up replicating too many parsing aspects in the lexer in a rather ad-hoc manner= . Nikita --047d7bfcf00069515405107291fe--