Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:118966 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 58028 invoked from network); 4 Nov 2022 14:59:21 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 4 Nov 2022 14:59:21 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 8B989180210 for ; Fri, 4 Nov 2022 07:59:20 -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.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS19151 66.111.4.0/24 X-Spam-Virus: No X-Envelope-From: Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) (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:59:20 -0700 (PDT) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 985BD5C00EE for ; Fri, 4 Nov 2022 10:59:17 -0400 (EDT) Received: from imap50 ([10.202.2.100]) by compute1.internal (MEProxy); Fri, 04 Nov 2022 10:59:17 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= garfieldtech.com; h=cc:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1667573957; x= 1667660357; bh=O3V4lSObXNHMw3DgkGBGazMKWmMd5C+i4PX0/R7OotE=; b=d Wp7Z27+ZBLVFbuNTUOaBTJy78sdURz8BNPcEIx47mSzjZj/kI+4VF1clf8QaJ2WQ HNrYuYaxKRmaMA0KGn23DEa3y8ahtKyMuCDJENpc8F2gJNtIyxmOuIv41ujGTETH Eu7+t4fB5WtJ5XLJ9a04wSykiBH0i39VsDstbSX7UIqoKNss1P+NAdW9gVVTNr6C W6dTQKBuvEt1c3lzGmpcBGwbrmCLXKdUiPnpmVwGm/rbuv3KfvWeyOf5pSTqdvOp oTD6XJpXHCRgtHBl/WOsZxzgj7VMnJS/m5RFD9jTqfUfNcI433YIngiR9QAWkjjy e9crERQS8WYVuPnsUBS1g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:date:feedback-id :feedback-id:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:sender:subject:subject:to:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; t=1667573957; x=1667660357; bh=O3V4lSObXNHMw3DgkGBGazMKWmMd 5C+i4PX0/R7OotE=; b=qVD3qe2X0hsM4kH8OWT7mUl9mzStH0p1FV5BjI+IrgxJ o/vGvkog3BAIIc51wowD1lfa1j1MpPJX2cEQ1+4jHW1lj5H0dtx+wVi5YBaSBhB3 QYQ6LZHgLXquL3Pd4qIlKXUw/I/aLxsHX+HziWJI0zup4gdu31mhQB57tdMQYmR8 eRVn0wNzNNJe3bSMzbT0DKdvuz7c2QQnBz7jwt6+mSNnbR5MrE4+6aEoSwcxGcWS gZ93bMrssvChYK15OI4XmwqoXL9nw0oQX6V9ZugAvE8PRcWe0QWxDoqWZOsQzP0d QK9b2+uHFhQcdIhyQ7SVnBlw9KnyinouaIR1sN2K6g== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrvddugdeikecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefofgggkfgjfhffhffvufgtsehttdertderredtnecuhfhrohhmpedfnfgrrhhr hicuifgrrhhfihgvlhgufdcuoehlrghrrhihsehgrghrfhhivghlughtvggthhdrtghomh eqnecuggftrfgrthhtvghrnhepgeelgfekudeivddvteffueejffdthfejieevhefgffek udevkedtvdelvddvffefnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrg hilhhfrhhomheplhgrrhhrhiesghgrrhhfihgvlhguthgvtghhrdgtohhm X-ME-Proxy: Feedback-ID: i8414410d:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 6E6421700089; Fri, 4 Nov 2022 10:59:17 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.7.0-alpha0-1087-g968661d8e1-fm-20221021.001-g968661d8 Mime-Version: 1.0 Message-ID: In-Reply-To: <655a8d92-e691-3631-f8a2-1c083029766e@ralf-lang.de> References: <655a8d92-e691-3631-f8a2-1c083029766e@ralf-lang.de> Date: Fri, 04 Nov 2022 09:58:56 -0500 To: "php internals" Content-Type: text/plain Subject: Re: [PHP-DEV] [RFC][Dynamic class constant fetch] From: larry@garfieldtech.com ("Larry Garfield") On Fri, Nov 4, 2022, at 9:45 AM, Ralf Lang wrote: > Hi Ilija, > > Am 04.11.2022 um 15:25 schrieb Ilija Tovilo: >> Please let me know if you have any thoughts. >> >> Ilija > > That new way of accessing class constants dynamically does not really > make things more readable for me. Maybe I just need to get used to it, > but especially that last example would make my head spin without > additional comments: > > Foo::{test('foo')}::{test('bar')}; Maybe I miss the use case. What kind > of code would benefit > from this? Wouldn't just using constant() for dynamically built > constant > strings be more legible? Maybe in a separate line? In the past I used a > lot of flag constants backed by integers. A lot of these use cases have > become classes/types in their own right since. When do you use these > constants? Just my thoughts. Dynamically building strings for syntax is almost never more legible. :-) I doubt you'd ever double them up the way some of the examples show. In practice, the single Class::{$const} or Enum::{$name} would be the most common uses, I predict, and those are way nicer to read than the 3x longer constant() with string concat. --Larry Garfield