Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:110488 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 21832 invoked from network); 11 Jun 2020 21:40:08 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 11 Jun 2020 21:40:08 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 955491804F4 for ; Thu, 11 Jun 2020 13:24:21 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-wm1-f53.google.com (mail-wm1-f53.google.com [209.85.128.53]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Thu, 11 Jun 2020 13:24:20 -0700 (PDT) Received: by mail-wm1-f53.google.com with SMTP id u13so6158414wml.1 for ; Thu, 11 Jun 2020 13:24:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:from:to:references:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding:content-language; bh=jhsybAQ9GoQSe2cE8KJ/hCbFRrVGfG5hYxcIdKqkr+k=; b=NccXOrvfjkm3RN8LvdxwiEpHWqfBtmGcGuihNAe7LHH3oq3Dk9Ro7UA+ZoSlUzn8Un 3jHnPa0REnKErtzSj3udqEQnQFu19K920J22Crj+67lafwqjEqpYlVhCr+4Y4RhMli9k uv+UxbIxn15PI0vpqG76eiF++OEDJmIZuopAumEZtzaEyZQtr/JKnEqEd9LxQQJQIoHi yEoTH9DGopbOh82VQJAyO3qvCTXUMriW/o1EL26pGEOutBGL2awYxgggLnkYUvfe36ow iQLbAlJlvzdqpa2PWXZjH1rrs9JXPbU76+mytbir7dx6AiRC15xNdTCMzGXMO6LaisYf C5Kw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:references:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=jhsybAQ9GoQSe2cE8KJ/hCbFRrVGfG5hYxcIdKqkr+k=; b=XGWQWmSXQqQurm70CUJphO8XKbfMU3UcrTsmZGA8fT6pVmAZW/ue/oN+IldeYQCVzZ +a/I7N3X7/O7IPn0A700oTxYLedRwp0c1peJIh8DjhU1oG8EcAkFYaebVsfHJO07UPRD TpC+ulfbq0qvK0Nml3vHcOPZptgdTTepHgSSxsoWF1wrZZWPjl+Z8tVrwMEkb7z9P+yX 8q7zsT5a3B8Fb6rncMYyb3c7VSKu2It4PC8ZYWK2entMfBwz7Pi167iTais6VJ1ESONk vp9ChtVMllUe/e6rhPMsyCPdoOZUN4LOn9S5KBtH8S5nbTo9957QgjcF0lQxB2km1R1l Sqyw== X-Gm-Message-State: AOAM5327FQ5YhmQDArCGeqMcsqADwlr7DkKbf5zXvZ8ywvrKcVg2XZl0 dLNt1cMiZ82lMX5um0jqeigfuFqr X-Google-Smtp-Source: ABdhPJzcO8lG8Sn8ELoyT5ZeUT/zoid9dFTFVLyygB1BazECQjzYJVBuHGC6/aOibtD2/WMMvlPwoQ== X-Received: by 2002:a1c:1d16:: with SMTP id d22mr10058384wmd.174.1591907058547; Thu, 11 Jun 2020 13:24:18 -0700 (PDT) Received: from [192.168.0.22] (cpc84253-brig22-2-0-cust114.3-3.cable.virginm.net. [81.108.141.115]) by smtp.googlemail.com with ESMTPSA id q1sm5419941wmc.12.2020.06.11.13.24.17 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 11 Jun 2020 13:24:18 -0700 (PDT) To: internals@lists.php.net References: Message-ID: <3bb65fdf-08a6-4d68-3b6b-55fa4ca5f12e@gmail.com> Date: Thu, 11 Jun 2020 21:24:16 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.9.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-GB Subject: Re: [PHP-DEV][RFC] Rename T_PAAMAYIM_NEKUDOTAYIM to T_DOUBLE_COLON From: rowan.collins@gmail.com (Rowan Tommins) On 10/06/2020 22:38, Rowan Tommins wrote: > rather than renaming T_PAAMAYIM_NEKUDOTAYIM, we should simply ensure > the user never needs to see it. I'd like to clarify this slightly: I should have said "beyond renaming ... we should ensure" - I have no particular objection to changing the handful of places outside of parse errors that T_PAAMAYIM_NEKUDOTAYIM might appear. > If I understand correctly, the current proposal will instead give us > this: > > > Parse error: syntax error, unexpected '::' (T_DOUBLE_COLON) > > But why not simply this: > > > Parse error: syntax error, unexpected '::' To ensure I'm not making unreasonable demands of others, I had a go at implementing this change, resulting in this straight-forward patch: https://github.com/php/php-src/compare/master...IMSoP:parse-error-poc?diff=split I believe there's code in zend_yytnamerr that could be tidied up if we never want these token names, but also scope for other improvements in the output - for instance, we might want to say "unexpected quoted string 'foo'" instead of just "unexpected 'foo'". There's also at least dozens of tests that will need to be changed to account for the new messages. However, it's enough to demonstrate the difference such a change would make: Input :::::::::::::::: Before Parse error: syntax error, unexpected '::' (T_PAAMAYIM_NEKUDOTAYIM), expecting end of file After Parse error: syntax error, unexpected '::', expecting end of file Input $$$$$$$$$ Before Parse error: syntax error, unexpected end of file, expecting variable (T_VARIABLE) or '{' or '$' After Parse error: syntax error, unexpected end of file, expecting variable or '{' or '$' Input "foo" "bar" Before Parse error: syntax error, unexpected '"bar"' (T_CONSTANT_ENCAPSED_STRING) After Parse error: syntax error, unexpected '"bar"' I think all of the above examples are easier to understand after than before. I would be interested to hear reasons not to pursue this idea further. Regards, -- Rowan Tommins (né Collins) [IMSoP]