Re: [Discussion] Implicitly backed enums

From: Date: Tue, 21 May 2024 23:24:25 +0000
Subject: Re: [Discussion] Implicitly backed enums
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
On Tue, 2024-05-21 at 18:48 -04:00, Bilge <[email protected]> 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 cannot originate from a conversion of some input. It is particularly
useful when refactoring in a large codebase to know that every way SomeEnum::A can be constructed
will contain an explicit reference to that case in code.

The uses you suggest are not without merit, of course! And that's why I'm also grateful
for backed enums as an option where they make sense (e.g. for values which are ultimately stored in
a database).

mjec


Thread (21 messages)

« previous php.internals (#123391) next »