> Am 29.01.2021 um 18:15 schrieb Larry Garfield 
> <la...@garfieldtech.com>:
> 
> And we're back again.  The RFC has been updated with a steady stream of 
> smaller improvements based on feedback and testing, and is now in its Final 
> Form(tm) (we think).  The only major change worth noting is that we renamed 
> things. :-)
> 
> An enum with no scalar backing is now called a Pure Enum, made up of Pure 
> Cases.  One that does have backing values is called a Backed Enum, made up of 
> Backed Cases.  That change is mainly to allow for future expansion to 
> non-scalar backing static values, should the use case arise.  Reflection was 
> also reworked a bit to make it more logical.
> 
> https://wiki.php.net/rfc/enumerations <https://wiki.php.net/rfc/enumerations>
> 
> At this point, Ilija and I consider the RFC done and ready for a vote.  
> Baring any major issues being brought up, we plan to start the vote in the 
> first half of next week, probably Tuesday-ish.  If you have any other bug 
> reports or tweaks, please speak now or forever hold your patches.

Hey,

There is a single point in the RFC which is unreasonable to me, which is 
barring static properties.
I do not consider static properties to be handled the same than normal 
properties. It's perfectly reasonable to prevent normal instance properties if 
we want [pure] enums to be stateless (which makes sense).
It however does not make sense to arbitrarily restrict static properties. In 
the end a static property (on final classes at least) is mostly a nice way to 
express global state, which could be written "global 
$my_namespaced_enum_class_prop_name;" and used then. It's just that 
self::$prop_name is much more readable and user-friendly, including for types 
and static analysis.

I also agree with Nikitas note that IterableEnum is really a suboptimal name. 
If you want to highlight finiteness, maybe call it FiniteEnum. UnitEnum would 
be fine too.

Thanks,
Bob

> --Larry Garfield
> 
> -- 
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: https://www.php.net/unsub.php 
> <https://www.php.net/unsub.php>

Reply via email to