Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:120268 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 41350 invoked from network); 14 May 2023 09:16:12 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 14 May 2023 09:16:12 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 5BC8B180382 for ; Sun, 14 May 2023 02:16: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=-0.2 required=5.0 tests=BAYES_40,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, T_SCC_BODY_TEXT_LINE 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 (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Sun, 14 May 2023 02:16:09 -0700 (PDT) Received: by mail-wm1-f53.google.com with SMTP id 5b1f17b1804b1-3f50020e0f8so20770415e9.0 for ; Sun, 14 May 2023 02:16:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1684055768; x=1686647768; h=content-transfer-encoding:mime-version:message-id:references :in-reply-to:user-agent:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to; bh=519LnnfVYZHeHFZiPBZkxoX7p+SCGe9Z2Xcmn5Xs/Rs=; b=Cc/KCqdLTQFDRqh3gOyDNy7N5rfA3hpLCckvkV0IhYX24cVorGdXTVIZyDYxIPVpPo K+xbfie2dfzZ+VWBxLoLX0LXn7VzmnPMJYmva3XN3N2gGBS/Q3Rc2hMIVvRsp/+37Ys+ IGBjCAIubDBGNRtpC7tUnfhS/Gmw8DXrXuKAGNGZnZYPodTtHFI896bf4Hh/ybucW2O5 sViptccx5PS+NZHvHCWv+5fCaBjrMDP42PPF8BQdYMOjmgngAgfeUTFtB90jZNtss4pl /o6u9PTVBj25zFfdVl5RWC8rF2GmGZsoecQm8mpLduB6M6m3+mFTROOZuxmChDS++8LY q/CQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684055768; x=1686647768; h=content-transfer-encoding:mime-version:message-id:references :in-reply-to:user-agent:subject:cc:to:from:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=519LnnfVYZHeHFZiPBZkxoX7p+SCGe9Z2Xcmn5Xs/Rs=; b=iBDJ9D3BVKZFrQySOQouqHj2S1c+rB7j2xUDG+rEp/WFp14SUMIJKB9IkDHBoj+HcO RRyyoRirSesY0M5YxzxPmhV8cWxZ7SMe7dFHQJ0rUr+QYIZBKx1hCvzn2dN4z5f73VLh YSetrl3cPy0PFB+9KeahvwGwbrfZCiW/z/eHaqJgeo/41RgfsjMvPIlRLWz98s13BGt1 5szGoj9TcGiVk75fSj/HDg/9nQzkMkF6c77oCGEeuAgAds7MTS9osbIRxe/e32dwug7P VmG73oyA6X3JKN8VPoyOFNxScmFnFo/GgQThqagn3HdI4afzwytdyzFF6bHCSPRt3FH8 RtQQ== X-Gm-Message-State: AC+VfDzpzFkBihPYTA76XW84nNm/EopQ9soPamiZ78Ay+UJsmfhZbSHX xKyLEpx3WGWh9ZTkhYmv5Kk= X-Google-Smtp-Source: ACHHUZ4mZS3mIjwJjKdDCQU0PlbY9+afDfN0BQoJ8Vr037u64Pw2issrD/+rQU66VFICYAa79Hv02w== X-Received: by 2002:a05:6000:d0:b0:307:bb47:75de with SMTP id q16-20020a05600000d000b00307bb4775demr10008949wrx.26.1684055768063; Sun, 14 May 2023 02:16:08 -0700 (PDT) Received: from [127.0.0.1] (cpc83311-brig21-2-0-cust191.3-3.cable.virginm.net. [86.20.40.192]) by smtp.gmail.com with ESMTPSA id b15-20020a5d4b8f000000b003064600cff9sm28735264wrt.38.2023.05.14.02.16.07 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 14 May 2023 02:16:07 -0700 (PDT) Date: Sun, 14 May 2023 10:16:06 +0100 To: Robert Landers CC: internals User-Agent: K-9 Mail for Android In-Reply-To: References: <436378BB-FDFA-43BD-A633-C030C347E683@gmail.com> Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] [RFC] [Discussion] nameof From: rowan.collins@gmail.com (Rowan Tommins) On 13 May 2023 16:40:27 BST, Robert Landers = wrote: > Most of the time, you want the unqualified name > =2E=2E=2E >This is especially important when using traits and aliases: I don't think trait renaming is the same thing as aliasing a qualified nam= e=2E In a sense, it's actually the opposite: with a trait, the compiler is = inserting the code of the method under the new name, and the name from the = trait can no longer be used to access it; for namespace imports, the compil= er is substituting the fully-qualified name, and the *local alias* can no l= onger be used to access it=2E The "real" name of a method copied in from a trait is whatever it's called= in the target class, but the "real" name of a function aliased with "use f= unction =2E=2E=2E as =2E=2E=2E" is undoubtedly its fully-qualified name=2E >In this case, if you want to use nameof(TEST) in an error message or >something else, it would be surprising to get \A\A instead of TEST=2E Would it? As I said before, my intuition was completely the opposite, that= one of the advantages of writing nameof(TEST) rather than just 'TEST' is t= hat it would resolve namespace imports the same way ::class does=2E Can you give an example of such an error message that would want to expose= the local alias? >So, for your example, we can instead call nameof(\Acme\bar(=2E=2E=2E)) >instead of the aliased name when passing to another context: > >use function Acme\bar as foo; >=2E=2E=2E >#[SomeAttribute(callback: nameof(\Acme\bar(=2E=2E=2E))] >=2E=2E=2E > >I hope this helps! Not really, I'm afraid=2E If I have to write out the fully-qualified name,= why would I bother with nameof() rather than just using a string? The more I read in this thread, the less I understand what the point of na= meof() actually is, and how it would be used=2E Regards, --=20 Rowan Tommins [IMSoP]