Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:110610 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 12350 invoked from network); 16 Jun 2020 22:08:40 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 16 Jun 2020 22:08:40 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id F2AFE180504 for ; Tue, 16 Jun 2020 13:54:10 -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=-1.6 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,HTML_MESSAGE,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE 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-yb1-f182.google.com (mail-yb1-f182.google.com [209.85.219.182]) (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:54:10 -0700 (PDT) Received: by mail-yb1-f182.google.com with SMTP id a80so142847ybg.1 for ; Tue, 16 Jun 2020 13:54:10 -0700 (PDT) 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=vzzqJRWWt/s11Kv4S7nkagR4Q8dzjRkfBVtiDHXACWU=; b=d2NEHWMj2mInCIVQvuMPDagQ6zBwA3RdRC3PMpnNpUQU5Bc1DUBERd814nzRHrfUiq BslPjy+tLdcQ1GxzPVritDRqtDRjG3cxSd0mh1eXx7X9lddimu9R0iFHWFldGxkngB+4 RpD6qjFzGAa8qRPtQbO0471UqmQw/SGnVhf+O50yURHxJMpIrgU+lov5i/XhaOQyyuit 6ph1HCoq2ZHtjaW0jCHiVjy7CcuwqxKAlbHDq91BTbz2OXY7Z7SH9CzgBy+duq94H6yo hv//9H6K7izrk5bdOqCE8VefTEl0yRWQfgyI2qHmJo/cgYNJxRtNL167Xi3EogdOHNpi yblA== X-Gm-Message-State: AOAM530898cGGQmSH2Y3sfUUsogCrY15Bs43pjh1p1AgrKT30/ytj6Cx l1NPpXHJjKoQ6eXZANySc1F1i0VT37QynF2inzFfsA== X-Google-Smtp-Source: ABdhPJy8OGIO9XWxIUuBGvRmxi3Rz1vn4nLcYnDhSRiZlOvztzwWXN6iAZiaSjcHovnBWcivVsEOkFOSL6Bh4NLzMWU= X-Received: by 2002:a25:51c1:: with SMTP id f184mr7088149ybb.115.1592340848916; Tue, 16 Jun 2020 13:54:08 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Tue, 16 Jun 2020 13:53:58 -0700 Message-ID: To: Nikita Popov Cc: PHP internals Content-Type: multipart/alternative; boundary="000000000000a94fff05a839be04" Subject: Re: [PHP-DEV] [RFC] Treat namespaced names as single token, relax reserved keyword restrictions From: davey@php.net (Davey Shafik) --000000000000a94fff05a839be04 Content-Type: text/plain; charset="UTF-8" On Tue, Jun 16, 2020 at 1:34 PM Nikita Popov wrote: > 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. > Hadn't considered this! Good point. > > 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? >> > Looks like I was, consider my concern assuaged :) > >> 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. > But now the namespace _is_ a single identifier. Or at least, it creates some (minimal) confusion here IMO. - Davey --000000000000a94fff05a839be04--