Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:120263 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 77308 invoked from network); 13 May 2023 15:58:22 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 13 May 2023 15:58:22 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id B371C1804AA for ; Sat, 13 May 2023 08:58:21 -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-oo1-f48.google.com (mail-oo1-f48.google.com [209.85.161.48]) (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 08:58:21 -0700 (PDT) Received: by mail-oo1-f48.google.com with SMTP id 006d021491bc7-54ff84bdbd8so1235505eaf.0 for ; Sat, 13 May 2023 08:58:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1683993500; x=1686585500; 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=d8Yw7m5fmpz6QA5Ugdj3QuxmR+KGKocvOrTIr0o1Sos=; b=RIw9z2nK7rJRiBCfkSP7hGqNKW+CjXjnI907BzceL3501MDGoMx4XKUfajp+wJzGnk gVK/I4vmHrVCWS4MtroAsIpiL6XI5XUN68Ha7mfY5qscN9dOFoZsz6GRSUBq6CdsYDKv eXamk8pryXKZoYWkrjuXpmb1Kyb/mzO64382nBUepHdzu0rOrSK05ci42Ds/Jsa5+xy5 Ibcmu3Fhu1gfjDCCUFxGFdahkHp3b8znx15VAT9M4Lcpco29tCL/v50oGiyp6VGMgU74 3LjaP2DcAKFgI6mOkZWE8VaURJyYQ0ourbl2NcqjjWniR1LGo2dLdZc2MOCvz5+rnDsB Gabw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683993500; x=1686585500; 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=d8Yw7m5fmpz6QA5Ugdj3QuxmR+KGKocvOrTIr0o1Sos=; b=fm4r+IQuSNPhYJJCsdrg/f+OU+iKIejR2t21eu9NLE+jEurm8IzzzeTJGottdQjtZk C4lMGSo+JTblDxpAXpQ3tJnmdDpzUHOfHTi6x8JaN02JtnODQTlEH+vBre7JsA0ngvzF XgH3fmfVgsNKt3n2MkUucR0umUSPN6nVGEO/Xh5K9OPEsqBWwP41asef9/VTQ9eAxn04 +Ag+FPBt0qK7hcB2IvAMEjimIiWpxGG6LyuU4PDZqsFf1HVubS8x5D+WZggV8KM/ro1l fT9bLTf9UIJJwnbVlq3p0gb9Oj91N/noGxOAIx2iJliXbPEzPzGHaJybdoSMV2ML/4rW wyMw== X-Gm-Message-State: AC+VfDxIt+V0amCJc1xx2oGs0koJ1CrQpKhm3Rs9Da1qTPJIudSFcK7B pd4Rh0x690JfrUrZf0eNKYKb2xqT89NOFCtxZUK1aIKsR9I= X-Google-Smtp-Source: ACHHUZ65ppFcnkmb8C0KCeTL6H5S43i6Zni6ll4jKOzaEuOif+E5evLQJKyFgehcgauX8+bDvl2nYL3gr5mVEenfxYY= X-Received: by 2002:a4a:9c4b:0:b0:54f:8511:b20 with SMTP id c11-20020a4a9c4b000000b0054f85110b20mr7724528ook.5.1683993500403; Sat, 13 May 2023 08:58:20 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Sat, 13 May 2023 17:58:08 +0200 Message-ID: To: Dan Ackroyd 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) > Can you provide more details on what the error conditions are? I can > see 'non-existent static variable' and 'non-existent variable', are > there others? Absolutely! I'll add it to the RFC later tonight, but the gist is that it would be exactly the same as if you were to call any function with something that doesn't exist. > > An exception model was considered, however, the author believes that > > it would break the concept of =E2=80=9Cusing nameof wherever a string c= ould > > be used=E2=80=9D and wouldn't be practical for the engine to handle all= of > > those cases. > > Can you put some detail in there ....I don't understand the problem, > or what you mean by it not being practical to 'handle all of those > cases' . I can do that, I agree it probably isn't as clear as it could be. One issue that was identified is that if this can be used anywhere a string/constant can be used, there may be edge cases where there is no way to handle an exception there because a try-catch isn't an expression. For example, in attributes, I'm not 100% sure the engine is set up to handle an exception being thrown while defining an attribute, nor how you would catch such an exception in a graceful way. I could be completely wrong, in which case I can add back that option. > > each one has its own merits but ultimately will > > be left up as a secondary vote: > > One of the reasons the RFC process has served PHP pretty well is that > it forces people to think through the details. > > I really don't think putting a few options up and hoping that people > choose the best one is a good way to design a language; it allows > skipping over thinking the details through. > > And yeah....this is one of the reason doing RFCs is annoying. People > are often persnickety over details. That is fair :) After some discussions with colleagues, I realized how errors are output and handled might be a contentious topic. I decided to make it a secondary vote -- and hopefully -- the discussions we're having now might inform voters on the best way to vote for how errors are handled. I don't have a personal preference (but apparently some people do), and I'd be happy with any of the solutions.