From my read, SplEnum is a bit janky -- you still have
to defibe integer
constants and may have to pass them in.
The proposal here is more "php-natural" in that you can say Month::$JANUARY
similarly to how you'd use Month::JANUARY, whereas SplEnum recommends the
more verbose new Month(Month::JANUARY) or such.
You could still do that with SplEnum though by adding the properties, but
SplEnum doesn't look like a really fancy wheel; there might not be any
benefit to using it if we're just going to use it differently.
-- brion
On May 21, 2014 2:53 AM, "Antoine Musso" <hashar+wmf(a)free.fr> wrote:
Le 21/05/2014 00:32, Sumana Harihareswara a écrit :
Hello,
I will not be able to attend, but have a minor concern. The Typesafe
enums RFC mentions PHP build in [SplEnum] class and dismiss it because
it is unintuitive.
Before reinventing the wheel, it would be nice to elaborate a bit more
as to why SplEnum is unwanted. I am afraid of having to maintain yet
another piece of custom code and make the MediaWiki learning curve
slightly worth.
Ideally we would work with upstream to enhance it and match our needs
but I guess it is going to take too long (ie years before it land in
production).
[SplEnum]
http://www.php.net/manual/en/class.splenum.php
cheers,
--
Antoine "hashar" Musso
_______________________________________________
Wikitech-l mailing list
Wikitech-l(a)lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l