Re: Enums should implement Stringable interface by default

From: Date: Fri, 28 Feb 2025 19:34:33 +0000
Subject: Re: Enums should implement Stringable interface by default
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-126527@lists.php.net to get a copy of this message
On Fri, Feb 28, 2025, at 10:11 AM, Rowan Tommins [IMSoP] wrote: > On 28/02/2025 08:33, Janis Kajaks wrote: >> My suggestion is that all enums (both basic/pure and backed) should >> implement Stringable interface by default, > > > This has come up at least twice before: > > * https://externals.io/message/118040 > * https://externals.io/message/124991 > > These threads also touch on some of the same issues: > > * https://externals.io/message/120121 > * https://externals.io/message/123388 > > Fundamentally, there are different schools of thought on what an "enum" > should be, which lead to different sets of features. > > I think some of those differences are fundamental enough that you could > only have both if the language had multiple enum-like things which the > user could choose between. Also see: https://peakd.com/hive-168588/@crell/on-the-use-of-enums Not auto-implementing Stringable was a deliberate design decision, for reasons that have not changed. --Larry Garfield

« previous php.internals (#126527) next »