Thank you so much for moving this forward, Larry and Ilija! I myself have
tried to draft my proposal at https://wiki.php.net/rfc/enum_v2 which has
aspects both similar and different from yours. And "v2" is another
indicator that this feature is desired by many, so yay.

On Sat, Dec 5, 2020 at 2:25 AM Larry Garfield <la...@garfieldtech.com>
wrote:

> https://wiki.php.net/rfc/enumerations


A few comments:
* Having to write "case" everywhere is extremely verbose, I can't think of
a popular language that requires so much typing in this area. Can the
keyword be omitted completely?
* Performance concern: I suspect that most developers will not use the
advanced features from this proposal and your future plans much, instead
they will want to use it in very simple contexts, e.g.
"$order->calculateWeight(Weight::Gross)". Would every such call require an
object allocation and initialization? What about comparisons, would
expressions like "if ($cardType === Suit::Clubs) ..." require a new object?
* What do you think about the part of my proposal that allows omitting enum
name where it's obvious from context, e.g. "pick_a_card(Clubs)" if the
declaration of pick_a_card() requires a parameter of type Suit?


-- 
Best regards,
Max Semenik

Reply via email to