Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:110645 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 68220 invoked from network); 18 Jun 2020 07:58:44 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 18 Jun 2020 07:58:44 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id A36A91804C3 for ; Wed, 17 Jun 2020 23:44:36 -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,HTML_MESSAGE, 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-ed1-f52.google.com (mail-ed1-f52.google.com [209.85.208.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, 17 Jun 2020 23:44:36 -0700 (PDT) Received: by mail-ed1-f52.google.com with SMTP id o26so4015737edq.0 for ; Wed, 17 Jun 2020 23:44:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:message-id:mime-version:subject:date:in-reply-to:cc:to :references; bh=5d2ooqJQqaa6Y0RlX44RE8kMdroYpydEnCA+hfLolqI=; b=eI0xCPm/9TNdmYHi7Hszix7st1VjphyTaois0NmvFCZL2YOROHfieaiXl4m5D9GiZ1 2V/jnOSZjcjx/Bi1xsZsvZlA4L2z1EFBt4RWGO1/Vt2YGxyeD6mxvD7r5gfwMT10Pvv9 95nysT3m4GuzKjpZjEcSf8nClNYGd2CK4CIdFFzGhNOy1mKgq2xp3NFVJCmnwxv96ODc KdfI9xzhk2ZAf8kOheco0FryanVZo/c1Y8odmWhY53+w3P00ZQcilwgRfCYmskaDzacK wrgC1FSZikvZEChK969kWCZmuSZcOShwUI/t8U/oSTz42z8SqMnqmwpTleFOjNZ38gb+ THdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:mime-version:subject:date :in-reply-to:cc:to:references; bh=5d2ooqJQqaa6Y0RlX44RE8kMdroYpydEnCA+hfLolqI=; b=R5NC+GBm6lbPZcm7WY/CvS+OhNlgIAw7IEgQTUSQY6Qkqh4iguNy3JPK26Qy9CsDqH G4oDt3UTY6WuXSXcS3TSxwm+sczUKUPU6NQddRhpMjv8h2efUTwOzCPRUssKLrWLm06g wkVSNgfUbrmttFz95lcWp8MNwihR1DFSIAOon43b9ap3iHdtkX5Nz+PC+qcgjDiPBlHU LuzLGtqoJwDHicwOnjRMqlssNCy3jkELRARz5u8W6Nj8ncCW6/Hdp0RuhzUUXTgeFBgX CxgJ6PY0PWrMWrEyIhNnwLwqBoZhQ3HPo73F7MUVPXl6nzusk5LgoFlwJP7CokUgEDhW PAHQ== X-Gm-Message-State: AOAM533PL03zXP+XLOrh6G804nTChPwWI4AyzSMQQytAFcILf/1HbBkr ekOlwZEA6Am0tgnRQtCVWR4= X-Google-Smtp-Source: ABdhPJwfOIoBxotaj8W7dXFFTfSgTdr3lmC8wOtMSblKGByJvxFWVV+V988zUzr/IJtXBRxWor7Y7g== X-Received: by 2002:a50:8d18:: with SMTP id s24mr2609999eds.303.1592462674219; Wed, 17 Jun 2020 23:44:34 -0700 (PDT) Received: from claude.fritz.box ([185.129.55.44]) by smtp.gmail.com with ESMTPSA id a13sm1571725eju.59.2020.06.17.23.44.32 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 17 Jun 2020 23:44:33 -0700 (PDT) Message-ID: <870E22A7-879D-415C-B7D0-71560B9CE156@gmail.com> Content-Type: multipart/alternative; boundary="Apple-Mail=_5CC91CDD-EC1C-43E5-9BE0-177169D4CF7A" Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.80.23.2.2\)) Date: Thu, 18 Jun 2020 08:44:32 +0200 In-Reply-To: Cc: PHP internals To: Nikita Popov References: X-Mailer: Apple Mail (2.3608.80.23.2.2) Subject: Re: [PHP-DEV] [RFC] Treat namespaced names as single token, relax reserved keyword restrictions From: claude.pache@gmail.com (Claude Pache) --Apple-Mail=_5CC91CDD-EC1C-43E5-9BE0-177169D4CF7A Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Hi, The following part of the proposal is problematic: Allow keywords in = definition of classes, functions, const, etc. class KEYWORD {} interface KEYWORD {} trait KEYWORD {} function KEYWORD() {} const KEYWORD =3D 0; use Foo as KEYWORD; Under your proposal, the following code will compile without notice, but = will have a different behaviour from what the programmer intended: ```php class Int { } const PRINT =3D 2; const YIELD =3D 3; function foo(Int $b) { return PRINT + YIELD; } ``` If it is important to allow to define classes, etc. with a keyword as = name, I suggest to force the programmer to say explicitly =E2=80=9CYes, = it is really what I want=E2=80=9D. For example, something like the = following: ```php class namespace\Int { } const namespace\PRINT =3D 2; ``` Another point which is problematic, is to allow `namespace` as a = namespace parts, since `namespace\foo`, although interpreted as a = namespace-relative name, could be intended to be a qualified name by the = programmer. =E2=80=94Claude > Le 16 juin 2020 =C3=A0 10:52, Nikita Popov a = =C3=A9crit : >=20 > Hi internals, >=20 > Inspired by the recent discussion on reserved keyword reservation, I'd = like > to propose the following RFC: >=20 > https://wiki.php.net/rfc/namespaced_names_as_token >=20 > This RFC makes two related changes: Treat namespaced names as a single > token, which enables use of reserved keywords inside them. And remove > reserved keyword restrictions from various declarations. >=20 > The RFC comes with a small backwards compatibility break related to = names > that include whitespace, but will hopefully reduce the backwards > compatibility impact of future reserved keyword additions. >=20 > Regards, > Nikita --Apple-Mail=_5CC91CDD-EC1C-43E5-9BE0-177169D4CF7A--