Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:118964 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 53486 invoked from network); 4 Nov 2022 14:48:47 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 4 Nov 2022 14:48:47 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 77FC91804BA for ; Fri, 4 Nov 2022 07:48:46 -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_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-ej1-f53.google.com (mail-ej1-f53.google.com [209.85.218.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 ; Fri, 4 Nov 2022 07:48:46 -0700 (PDT) Received: by mail-ej1-f53.google.com with SMTP id d26so13826762eje.10 for ; Fri, 04 Nov 2022 07:48:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=g5c+GqjKZT7O+IQREmaR6SQX3WKNd9l7niAjP8R7n/Y=; b=GdUL1HeZw8RQgYc8WH5KvT2mBRGN4aEHep5oIkT5X848TNXgAf18O67LPeMaMQlAW5 G+zqdmXDSDaWMyaNMaIQRK2xZ7O7W7sV9sQmHaxh25q8PO1zbfdhQWJX94r+yxNzh8pg HW0d2RdDGER0xJf+pXsAIKsMkKyZTTj+OBUFgZPJ/KRsfG4KnHcLV9qdppA7Gm60fttD 7Fpa2Ok+IHhuFpeLSvDCYXp8vkDoSFyA+yGTHXE2JdE/qauCbD0mUZ3MU1yqgxsSxFIG SGDRXcUwgfVrEMBWswO4kTQEeZRBeZADVYBckoXvKlGInbT6oDjfFZaGLMxMowiwFA3H iHvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=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=g5c+GqjKZT7O+IQREmaR6SQX3WKNd9l7niAjP8R7n/Y=; b=PoJ6n5UxDlr1jQ80pb+DTCZeVxBQTR/6dROwviloI//m28sx09Lw3DjG0HNPFAhcdY BQXpt55jQgp4Nl7oLh4J/al1HCbArkRMVv5JOYYWG+lT1nmlFYVjF1FWNtn/drrSOwzW HjgzXeyPY52rxzYNBAGIWlQbAfodZF8D5WnhN6RGCSxxt2s4EP1IR89E1LdSnO2I2WRd gHjAqVBfSaAxlSbSohXulLjKWn8TOZvQYOJ8Mp9SdcNWVs/C94z4fOucGSet+OepZya0 PXMPansFF6+FwJrB/YS1mtx2B1pNGW6EtceMorY1A4qD05djzNHuEHBEIb+r/RaJIC0b CvVg== X-Gm-Message-State: ACrzQf3i029Alq+o+WOndOs1RHNRkPP6CVPc1/s51aXj368aIuwdcTtZ JcdOSDuuFjCw9KmTeWWdJbm/zCvJJHLedw14OU0= X-Google-Smtp-Source: AMsMyM44SlArfnCL5/tgrPomxn8HPwu90RdsRd2hGABqOkj27VXy7dMI+ZNK8I88z93i1Q5YHY29wjkVOIR39GvwBe0= X-Received: by 2002:a17:907:2c68:b0:7ad:8ba7:664a with SMTP id ib8-20020a1709072c6800b007ad8ba7664amr34979735ejc.488.1667573324684; Fri, 04 Nov 2022 07:48:44 -0700 (PDT) MIME-Version: 1.0 References: <504f616c-05c1-45ef-991e-2b4c79f72d07@app.fastmail.com> In-Reply-To: <504f616c-05c1-45ef-991e-2b4c79f72d07@app.fastmail.com> Date: Fri, 4 Nov 2022 15:48:33 +0100 Message-ID: To: Larry Garfield Cc: php internals Content-Type: multipart/alternative; boundary="000000000000a7a28205eca62b87" Subject: Re: [PHP-DEV] [RFC][Dynamic class constant fetch] From: ocramius@gmail.com (Marco Pivetta) --000000000000a7a28205eca62b87 Content-Type: text/plain; charset="UTF-8" On Fri, 4 Nov 2022 at 15:40, Larry Garfield wrote: > On Fri, Nov 4, 2022, at 9:31 AM, Marco Pivetta wrote: > > Heyo, > > > > On Fri, 4 Nov 2022 at 15:26, Ilija Tovilo > wrote: > > > >> Hi everyone > >> > >> I'd like to propose a simple RFC to introduce looking up class > >> constants by name. We have dedicated syntax for basically all other > >> language constructs. This RFC aims to get rid of this seemingly > >> arbitrary limitation. > >> > >> https://wiki.php.net/rfc/dynamic_class_constant_fetch > >> > >> Please let me know if you have any thoughts. > >> > > > > What's the problem with using `constant()` for this? > > > > Marco Pivetta > > > > https://twitter.com/Ocramius > > > > https://ocramius.github.io/ > > As it says right in the RFC: > > // This: > echo Foo::{$bar}; > > // is way more convenient than this mess: > echo constant(Foo::class . '::' . $bar); > > This is something people have mentioned a number of times with enums and > dynamic case references, and seems like a good small cleanup. > What's convenient about `Foo::{$bar}` vs `constant(Foo::class . '::' . $bar)`? I'm a bit confused by this :| Is it the few keystrokes added? Marco Pivetta https://twitter.com/Ocramius https://ocramius.github.io/ --000000000000a7a28205eca62b87--