Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:110473 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 11376 invoked from network); 10 Jun 2020 22:54:20 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 10 Jun 2020 22:54:20 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 26BC9180506 for ; Wed, 10 Jun 2020 14:38:18 -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-wr1-f52.google.com (mail-wr1-f52.google.com [209.85.221.52]) (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 ; Wed, 10 Jun 2020 14:38:17 -0700 (PDT) Received: by mail-wr1-f52.google.com with SMTP id j10so3969357wrw.8 for ; Wed, 10 Jun 2020 14:38:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding:content-language; bh=8outftF/nUuo6etMixlO4gBDfGDVWT9AoJ99FgIcScw=; b=ajkqTRn4UTotWJxwxSuQgBt50P4DqMDTD/osR2wi+tNhf3Ib3W9u4L0MkaUjnfo6xT geTrY9Sb7fE8Q08tQqkF4vllk39Fcz/e+g9Xjx+DKXMWB3IDXJBxo+ykSppLbbzvCoYM 10Uivugjoo1C4ZuK3s4pwg79wMX1ZJv6ktd/PbfhtVA0CyGOCilJu/CJx8gQTi4oj3yB u5NbSYTWYIoixNmp277MdRdS9+P4SK90J9gcKKmwZ1pxQ09NR/86v15RCM+3TI/P8Rw1 37AE/fRbF2YhEHz/phBZoEafn3+ppAzyJiKfVoexhNEEO5cSXFXP+MGzEVCd2ZCEuEFd BAaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=8outftF/nUuo6etMixlO4gBDfGDVWT9AoJ99FgIcScw=; b=atsJZ3OxtM64aU3T6jj6rsoxVXCMBYp4fKfMvnlPOBAZmZgPt3/9B1HviYRlgNhEx+ 6V7+R6ImEdkC9H3Wv9w232N8MI0ix6fQVKCQQtUct4z0WbAEDiF8WhCw5+wlCZJbQgvc Q94cCL1Yky3CpD8CTwXHTUb1fRcs5hRwYgBKEaRw03152XGsN+DBVie19LS57ploiQJE nm2rOfpAXGugnIURSoYIZr52STk0uQcNBFkLcmhfplBUhib9lBPAUH8I97udhyL/lZbC lVfTobEpIYgsuXBstI2tK4Mc6KzTONAGu9tycnft6AX25tUupTy5pxThxxbfIsdHewAa LnDg== X-Gm-Message-State: AOAM5310kTo0hvH2sfTh13qUpqZOQyZtwmYu74irK20zYpJ8mj8B+KV4 xzkvzSDfr7REp4LXmXBVXw1F97I1 X-Google-Smtp-Source: ABdhPJzJXlKmvdFpU9Qb52CYzZnEGkNNhuAGdaM2qkKAL+gHMos7S0PzL8NUUAwgjeo+AIwbGGnXMw== X-Received: by 2002:adf:fc4b:: with SMTP id e11mr5826641wrs.202.1591825095875; Wed, 10 Jun 2020 14:38:15 -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 h12sm1577177wro.80.2020.06.10.14.38.14 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 10 Jun 2020 14:38:15 -0700 (PDT) To: internals@lists.php.net References: Message-ID: Date: Wed, 10 Jun 2020 22:38:13 +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 19:28, Claude Pache wrote: > One parsing error that I still find dreadful after more than 10 years of PHP coding, is: unexpected T_CONSTANT_ENCAPSED_STRING. Although T_CONSTANT_ENCAPSED_STRING is like Hebrew for me, I’ve learned with time that when I get such an error, it means that I’ve most probably omitted or mistyped some punctuation mark somewhere. I think this is a really good point, and I would like to expand on it: rather than renaming T_PAAMAYIM_NEKUDOTAYIM, we should simply ensure the user never needs to see it. A long time ago, PHP's parser errors were extremely cryptic, e.g. "::::::::::" would tell you: > Parse error: syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM Since PHP 5.4 (according to https://3v4l.org/Hdjk8) the error message includes the actual token encountered: > Parse error: syntax error, unexpected '::' (T_PAAMAYIM_NEKUDOTAYIM) 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 '::' Imagine you are a new PHP developer, who has only the vaguest idea of what "parse" means; along with '::' (T_PAAMAYIM_NEKUDOTAYIM) you may encounter such mysteries as these: '<<' (T_SL) '>>' (T_SR) __NAMESPACE__ (T_NS_C) ''foo'' (T_CONSTANT_ENCAPSED_STRING) [which is a string, not a constant] 'foo' (T_STRING) [which is definitely not a string, but might be a constant] ... (T_ELLIPSIS) [a lot of people will misread this as "ellipse", a much more common word] ** (T_POW) [is that the Star Trek character, or the rock band named after her?] Even straight-forward names like '==' (T_IS_EQUAL) are confusing - for years I wondered what that "T_" meant, my experience with Delphi making me guess at "type", which didn't make much sense. I can see a small advantage of including something that is easy to search for; but how often does the solution to a parse error depend on exactly what the unexpected token was, so that searching for "Parse error: syntax error, unexpected" wouldn't give enough of a hint? Other information currently missing from the message - e.g. column number, hints about unclosed blocks - is likely to be far more useful. Regards, -- Rowan Tommins (né Collins) [IMSoP]