Re: [RFC] Enumerations, Round 2

From: Date: Mon, 04 Jan 2021 11:15:18 +0000
Subject: Re: [RFC] Enumerations, Round 2
References: 1 2 3 4 5 6 7  Groups: php.internals 
Request: Send a blank email to internals+get-112746@lists.php.net to get a copy of this message
Hi,

On 03.01.21 12:01, Mike Schinkel wrote:
So in my perfect world this: enum BookingStatus {
      case PENDING;
      case CONFIRMED;
      case CANCELLED;
} Would be equivalent to: enum BookingStatus {
      case PENDING = "PENDING";
      case CONFIRMED = "CONFIRMED";
      case CANCELLED = "CANCELLED";
}
I'm with Mikes' suggesting here, see also my previous messages [1] [2]. I don't know how to back this up with numbers, but the way I see it the majority of use cases will have a benefit of being able to directly use the literal values derived from the lexical ones and the ability to have custom values is feature next to it. [1] https://externals.io/message/112626#112655 [2] https://externals.io/message/112626#112663

Thread (52 messages)

« previous php.internals (#112746) next »