Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:110609 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 9186 invoked from network); 16 Jun 2020 21:49:02 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 16 Jun 2020 21:49:02 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 8E5A31804FD for ; Tue, 16 Jun 2020 13:34:31 -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-lj1-f179.google.com (mail-lj1-f179.google.com [209.85.208.179]) (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 ; Tue, 16 Jun 2020 13:34:31 -0700 (PDT) Received: by mail-lj1-f179.google.com with SMTP id i27so91343ljb.12 for ; Tue, 16 Jun 2020 13:34:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=pJ02FqPLeq1xGacatMXeia68aB9L/lriBxmC0lqvBQU=; b=LhQ0T2ELUTxTIMiAKhmyPA/onMxa5r2R/BOZAjN6pqaoYuW5gYvZKLWl+bXlnS0hQP pdHFuKAv2ls06ftzilx6M8I6k+3nJvmNNhoaB8hDYwy9lvx6kCYjwZ3qW4/GPObzbpvH obnfaUS0Y1IiTK46r9oVrXNlYQBUeBVNu272WP8V2GEgs1nQLTycKkTr0fawArJe72q6 u9M4sPpxsCk2BRJSB/nGt9kWhYH2/cT9wL5vFbRsUj0mPv4FIwk4nohMaXmY3o72KUv5 sd7Ixr5cxqxd+ZfQiqjT4wY+LJGKVFjxmozi2OPI6YaNrkYpixYx8FKIYmEI1uH04oMH oECw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=pJ02FqPLeq1xGacatMXeia68aB9L/lriBxmC0lqvBQU=; b=Akg+6uj5tb3+AIcpyRr397vDHTJJF0YUjqFw/RKS57+4M5Mk3LqakzrUGwyR74amEh 5Q/BO0wjQZK1svInS0pJQR48mXTkd8MmvepqgN8gEPiDRyltD4AVmcR4VC/hUcmRYZ3f Bjrh/mxo9pMamok5/zIbjL7ujPss2DDOegvCoq+IUoTKlBnC8Zdx6gJIDtp1o3gxvmiv OAJemrj3U3VyrgEZBIkk/zoc0IEm6TjeAAe7Cb7EMSbAkHeI2UodTOhkusKSTG6Y5Qiu cD/iMcG4MOvD9z1cdC4lv1WlM7tzSX4rf3WgC5KKdmccu8yf/gGBUIl2LxHsooPGngQd fznQ== X-Gm-Message-State: AOAM531ZqSJq3EgaivLFAxSSMR880UDB4RYLPfOIOmlsi9z8+2bUzLMm xoug4u5tkh/5TFo/ME1xLhh2JLZ3GBa2aRJF0i2Gia9E X-Google-Smtp-Source: ABdhPJwKKeoP1eRTahPbg5uem7uiPBaRcc+VHRDQe0laOWRW52e+18JAwvpDzxfTqmugjYgX8oRt5L0k02pIkWOhLZQ= X-Received: by 2002:a2e:908f:: with SMTP id l15mr2088031ljg.307.1592339668165; Tue, 16 Jun 2020 13:34:28 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Tue, 16 Jun 2020 22:34:12 +0200 Message-ID: To: Davey Shafik Cc: PHP internals Content-Type: multipart/alternative; boundary="0000000000004867d705a83978cb" Subject: Re: [PHP-DEV] [RFC] Treat namespaced names as single token, relax reserved keyword restrictions From: nikita.ppv@gmail.com (Nikita Popov) --0000000000004867d705a83978cb Content-Type: text/plain; charset="UTF-8" On Tue, Jun 16, 2020 at 10:28 PM Davey Shafik wrote: > > > On Tue, Jun 16, 2020 at 1:52 AM Nikita Popov wrote: > >> Hi internals, >> >> Inspired by the recent discussion on reserved keyword reservation, I'd >> like >> to propose the following RFC: >> >> https://wiki.php.net/rfc/namespaced_names_as_token >> >> 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. >> >> 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. >> >> Regards, >> Nikita >> > > The only issue I have with this RFC is this: > > use Foo as KEYWORD; > > While this might be _technically_ correct, it is unusable. That is: > > use Foo as List; > > class Bar extends List { } // this will not work > That's correct. However, "class Bar extends List\FooBar" will work. I mainly allow this because "use Foo\Bar" is the same as "use Foo\Bar as Bar". If "use Foo\List" is allowed, it makes little sense to forbid the equivalent "use Foo\List as List". Given this, I think this specific syntax should be an error, unless I'm > missing something? > > Also, does this mean we can alias to fully namespaced names now? > > use \My\Foo as \Bar\Foo; > class Bat extends \Bar\Foo { } // now actually extends \My\Foo, not > \Bar\Foo (no autoload would happen?) > No, this continues to be not allowed. "As" does not accept a namespaced name, it accepts a single identifier. Regards, Nikita --0000000000004867d705a83978cb--