Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:120264 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 79281 invoked from network); 13 May 2023 16:14:53 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 13 May 2023 16:14:53 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id C4C62180503 for ; Sat, 13 May 2023 09:14:52 -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_H3,RCVD_IN_MSPIKE_WL,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-oa1-f45.google.com (mail-oa1-f45.google.com [209.85.160.45]) (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 ; Sat, 13 May 2023 09:14:52 -0700 (PDT) Received: by mail-oa1-f45.google.com with SMTP id 586e51a60fabf-1960539df06so6230012fac.1 for ; Sat, 13 May 2023 09:14:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1683994491; x=1686586491; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=zGtoH5+jQrTF/ZqVKZG7ToIIgUNTAvgBjXHZy2JCbKs=; b=ZZJ2LImM6I1Vei3WO1cnrcV1BDVYjINBQ5rhmlEaFTXRKjn1V/QnLWCXL9Mi4Sai3B G9MOKCN4oVZuPzQpACyziBGxc4vBx8oRFNQbhjLBwV2Ya3i9vtjXNp4ALu2KWL8C+q+K X5hMQ2EWrEiHmjsEJmzUeYDN6QzlvKwppFlX2U0bXJw0GjnU8A+OM8uxu9kc7oWERREW MS/b1x++tEzB2LQLNnCudJC2yV7+1ngsZNx1LhvwwOQ4iz3+b8AhVbMAGOa2lf3A9OlA OFemE0jktkgna6i/VHkMo6XdzhooTjKwGqZwk/QinSyVSvpaIjearHmjt92+2H97FxSX Cl3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683994491; x=1686586491; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=zGtoH5+jQrTF/ZqVKZG7ToIIgUNTAvgBjXHZy2JCbKs=; b=WmuKoDCniKe+RGvJNqfkPcDkLzmhRgdCUYVWf0UJITPYyUJyXg5eEbsz01rA2b1kgu VwTX2+uxRlUhHHFE6Y2vEdqj1Mv0ZS0PFSzMxUNC4LbqvmRpjunHibWIdqqDYBn80z41 Xed5207q45fxGOvAORAUtXlczXzxeT3IT8JKGmF5upM4qAzmsCcn+DOtS6gyeiPA8mB8 cLeh4GuFu8cBES8LneIsyNYRSZlLOy+2z9b7Awrs8EqudH+EcI6ikBFaXf/SZw0U6t+U cYzHjOKPZXdGGEHXVZkoTwG1vL7MiKCoGmoopZ0fW/ba6rFuMiLEKEaVYN+hV+JIWAAX iEvQ== X-Gm-Message-State: AC+VfDx8a40iu4B45gpJJW/Ida91NsYX8yHfZJLyomIFEHDlmuXUE+rL RZt7Ws1RENmDMFxPNw35iD/FVi4o6EGUO9gmvo9B8zqpiTA= X-Google-Smtp-Source: ACHHUZ606p/r/f0ArEQORooM+Zsuus3fz2kWv6IyMXodbKbuHjE68TsJujp/u1KqN0GPayl6KYqtAphCxWzwK9awqu4= X-Received: by 2002:aca:f046:0:b0:394:711d:d150 with SMTP id o67-20020acaf046000000b00394711dd150mr3511456oih.59.1683994491449; Sat, 13 May 2023 09:14:51 -0700 (PDT) MIME-Version: 1.0 References: <18792247-e016-2d49-253a-1a10efbde023@gmail.com> In-Reply-To: <18792247-e016-2d49-253a-1a10efbde023@gmail.com> Date: Sat, 13 May 2023 18:14:39 +0200 Message-ID: To: Niels Dossche Cc: internals Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] [RFC] [Discussion] nameof From: landers.robert@gmail.com (Robert Landers) On Sat, May 13, 2023 at 5:18=E2=80=AFPM Niels Dossche wrote: > > On 13/05/2023 09:27, Robert Landers wrote: > > Hello Internals, > > > > It is with much trepidation and excitement that I'd like to announce > > the `nameof` RFC (https://wiki.php.net/rfc/nameof). It has changed > > quite a bit in the last couple of days, so if you haven't seen the > > latest draft, please check it out. > > > > Essentially, it allows using `nameof()` anywhere a string can be used, > > even in static contexts. From a developer's perspective, it is a > > string and from the engine's perspective, it is also mostly a string > > (depending on how deep we want to go on error checking -- see the > > RFC). > > > > If anything is unclear or if I missed something, please let me know. > > > > Robert Landers > > Software Engineer > > Utrecht NL > > > > Hello Robert > > Thank you for doing the proposal. I can see some places where I might use= this. > > I have an additional question that I don't think has been asked yet. Abou= t the interaction of nameof with "variable variables": > What should be returned by `nameof($$variable)`, and similarly `nameof($$= $variable)`, etc? > Defining the semantics for this, and giving examples in the RFC text woul= d be great :) > > Good luck with your RFC. > > Cheers > Niels That is a good question. It should be a compile error due to ambiguity. I'll update the RFC to include that. $variable would already be the name of the variable being referenced by $$variable, so if you want the name of $variable, just get the name of $variable, and if you want the name of $$variable, just get the value of $variable.