Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:114497 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 90928 invoked from network); 17 May 2021 14:22:04 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 17 May 2021 14:22:04 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 37A0A180533 for ; Mon, 17 May 2021 07:31:19 -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.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Mon, 17 May 2021 07:31:18 -0700 (PDT) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 72C2E5C00DB for ; Mon, 17 May 2021 10:31:18 -0400 (EDT) Received: from imap8 ([10.202.2.58]) by compute4.internal (MEProxy); Mon, 17 May 2021 10:31:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; bh=GPYc0Fcetm7jtWV4azsJB0ezWitDLFcakpDGtkJVY h0=; b=Vt/MRXl4ANuOvdRqEATV8Twe/uIHh/hFr6bmp6NGjqrI5VukySyiPtZTc pMKVYE7FIjWD1j3qWGScPmYYrJjRWX1poyyNWoG6RZyG4/eHGRayw5sroy/ucytK qIUIx+3Kkgo7GLDDy6TZPAQYqAItSNRS+XMUh6fO2J0oQaw/sTbdbN71tB1wIsf1 NwDp/oemYM/Oz0eISudc4ZMB44jFABePlTSUVDPuRd/6qmX3Px+HKrGaggvP1s6t B7zEbOQ4o/J+hnoKq5ODoxD0JpZub774re5vvYxB4gE4wjviAGKreiNI0ddvryS2 FHI0ft+CBvef3L0H5mUvHKXoHb1vQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrvdeihedgjeekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvffutgfgsehtqhertderreejnecuhfhrohhmpedfnfgr rhhrhicuifgrrhhfihgvlhgufdcuoehlrghrrhihsehgrghrfhhivghlughtvggthhdrtg homheqnecuggftrfgrthhtvghrnhepgeeghefgteejheeggfeghfelueeggfdtjeeivedv tefhveeguedufeelhedvteeinecuffhomhgrihhnpehphhhprdhnvghtnecuvehluhhsth gvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheplhgrrhhrhiesghgrrhhf ihgvlhguthgvtghhrdgtohhm X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id 36EBA3A0130; Mon, 17 May 2021 10:31:18 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.5.0-alpha0-448-gae190416c7-fm-20210505.004-gae190416 Mime-Version: 1.0 Message-ID: In-Reply-To: References: Date: Mon, 17 May 2021 09:29:10 -0500 To: "php internals" Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] [RFC]: Allow static properties in enums From: larry@garfieldtech.com ("Larry Garfield") On Mon, May 17, 2021, at 9:16 AM, Micha=C5=82 Marcin Brzuchalski wrote: > pon., 17 maj 2021, 16:02 u=C5=BCytkownik tyson andre > napisa=C5=82: >=20 > > Hi internals, > > > > I've created a new RFC > > https://wiki.php.net/rfc/enum_allow_static_properties > > > > Although enums are immutable objects, it is often useful to have fun= ctions > > or methods that operate on enum instances. > > In many cases, it would make sense to declare that functionality as = static > > methods on the enum itself. > > In cases where static methods require shared state, it would be usef= ul to > > allow storing those shared state in static properties. > > To ensure immutability of enum instances, it's only necessary to for= bid > > instance properties, but all properties were forbidden in the initia= l > > functionality included with the enums RFC. > > > > This RFC proposes allowing static properties in enums, while continu= ing to > > forbid instance properties. > > >=20 > Would you be able to provide more real life example? > The example in RFC could easily encapsulate current Environment readin= g in > for eg. EnvironmentConfiguration class with static property and method= and > TBH possibly that would be my preference to solve this. I would agree. Static properties are ugly to begin with. They're globa= ls with extra syntax. I have no desire to see them on enums. Also a clarification, since it wasn't entirely clear in Tyson's original= email: Static methods on Enums *are already supported*. They were incl= uded in the original Enum RFC. The change proposed here is just about s= tatic properties. --Larry Garfield