Hi
On 5/23/24 20:57, Bilge wrote:
Fair enough; I think we've somewhat moved on from the initial suggestion
of implicitly backed enums, towards implicit values for string enums
(for those names without explicitly defined values). What is your
opinion on this alternative approach?
Generally not
On 23/05/2024 19:48, Tim Düsterhus wrote:
As for the initial suggestion of implicitly backing enums: I'm
strongly against that. Personally I find that backed enums are almost
never useful.
Fair enough; I think we've somewhat moved on from the initial suggestion
of implicitly backed enums, tow
Hi
On 5/23/24 20:34, Aaron Piotrowski wrote:
This solution is flawed. Not every constant is necessary an enum case. It also
isn't type-safe or as nice to read as tryFrom() and from() static methods.
Having regular class constants on an enum is somewhat questionable [1],
but fair enough. In
> On May 23, 2024, at 1:20 PM, Tim Düsterhus wrote:
>
> Hi
>
> On 5/22/24 02:48, Aaron Piotrowski wrote:
>> Perhaps not as clean and easy as the functionality being built-in, but it
>> gets the job done.
>
> I would suggest to use the built-in functionality then.
>
> enum cases are literall
Hi
On 5/22/24 02:48, Aaron Piotrowski wrote:
Perhaps not as clean and easy as the functionality being built-in, but it gets
the job done.
I would suggest to use the built-in functionality then.
enum cases are literally just class constants, thus you can access them
via the `constant()` func
Hi
On 5/22/24 01:31, Larry Garfield wrote:
A unit enum isn't serializable, by design.
A unit enum is perfectly serializable: https://3v4l.org/Mf9Ou
On Thu, May 23, 2024, at 1:35 AM, Robert Landers wrote:
> For what it's worth, the biggest downside to this decision is in
> upgrading old/legacy projects to use enums. Most of the time, you want
> to convert a const to an enum, and that also usually means it will be
> a backed enum. Since there's
On Wed, May 22, 2024, at 7:30 PM, Stephen Reay wrote:
> Sent from my iPhone
>
>> On 23 May 2024, at 03:58, Larry Garfield wrote:
>>
>> On Wed, May 22, 2024, at 2:29 AM, Stephen Reay wrote:
> On 22 May 2024, at 07:58, Larry Garfield wrote:
given that the casing for an enum should
On 22/05/2024 00:31, Larry Garfield wrote:
I could see an argument for auto-populating the backing value off the enum name
if it's not specified, something like this:
enum Options: string {
case First; // This implicitly gets "First"
case Second = '2nd';
}
This reminds me of the short-
On Wed, May 22, 2024 at 4:13 AM Larry Garfield wrote:
>
> On Tue, May 21, 2024, at 6:47 PM, Bilge wrote:
> > On 22/05/2024 00:31, Larry Garfield wrote:
> >> I could see an argument for auto-populating the backing value off the enum
> >> name if it's not specified, something like this: enum Option
Sent from my iPhone
> On 23 May 2024, at 03:58, Larry Garfield wrote:
>
> On Wed, May 22, 2024, at 2:29 AM, Stephen Reay wrote:
On 22 May 2024, at 07:58, Larry Garfield wrote:
>>>
>>> given that the casing for an enum should be CamelCase (per PER-CS)
>>
>> Hi Larry;
>>
>> I find myse
On Wed, May 22, 2024, at 2:29 AM, Stephen Reay wrote:
>> On 22 May 2024, at 07:58, Larry Garfield wrote:
>>
>> given that the casing for an enum should be CamelCase (per PER-CS)
>
> Hi Larry;
>
> I find myself yet again having to ask that php policies/discussions not
> revolve around the idea th
> On 22 May 2024, at 07:58, Larry Garfield wrote:
>
> given that the casing for an enum should be CamelCase (per PER-CS)
Hi Larry;
I find myself yet again having to ask that php policies/discussions not revolve
around the idea that PHP-FIG is a required/expected part of PHP usage.
Until a
> On May 21, 2024, at 6:47 PM, Bilge wrote:
>
> On 22/05/2024 00:31, Larry Garfield wrote:
>> I could see an argument for auto-populating the backing value off the enum
>> name if it's not specified, something like this:
>> enum Options: string {
>> case First; // This implicitly gets "First"
On Tue, May 21, 2024, at 6:47 PM, Bilge wrote:
> On 22/05/2024 00:31, Larry Garfield wrote:
>> I could see an argument for auto-populating the backing value off the enum
>> name if it's not specified, something like this: enum Options: string {
>> case First; // This implicitly gets "First"
>>
On 22/05/2024 00:31, Larry Garfield wrote:
I could see an argument for auto-populating the backing value off the
enum name if it's not specified, something like this:
enum Options: string {
case First; // This implicitly gets "First"
case Second = '2nd';
}
This seems like a reasonable co
On Tue, May 21, 2024, at 5:48 PM, Bilge wrote:
> On 21/05/2024 23:35, Larry Garfield wrote:
>> On Tue, May 21, 2024, at 5:30 PM, Bilge wrote:
>>> Hi Internals,
>>>
>>> I struggle to understand the benefit of "basic" enumerations and their
>>> diminished API. In particular, I often find myself wanti
On Tue, 2024-05-21 at 18:48 -04:00, Bilge wrote:
> >What would be the downside to having all "basic" enumerations actually
> being implicitly "backed" enumerations?
I'm not Larry but I see a lot of value in knowing that a unit value was
explicitly constructed in code, and where the value canno
On 21/05/2024 23:35, Larry Garfield wrote:
On Tue, May 21, 2024, at 5:30 PM, Bilge wrote:
Hi Internals,
I struggle to understand the benefit of "basic" enumerations and their
diminished API. In particular, I often find myself wanting to use
`from()/``tryFrom()` to convert a string to an enumera
19 matches
Mail list logo