Re: [PHP-DEV] [RFC] Enumerations

2020-12-07 Thread Olle Härstedt
On Mon, 7 Dec 2020, 21:36 Olle Härstedt, wrote: > Did you discuss exhaustiveness checking already? > Nevermind, this is done by match already. > On Sat, 5 Dec 2020, 00:25 Larry Garfield, wrote: > >> Greetings, denizens of Internals! >> >> Ilija Tovilo and I have been working for the last few

Re: [PHP-DEV] [RFC] Enumerations

2020-12-07 Thread Olle Härstedt
On Sat, 5 Dec 2020, 15:43 Larry Garfield, wrote: > On Sat, Dec 5, 2020, at 3:26 AM, Pierre R. wrote: > > Le 05/12/2020 à 00:24, Larry Garfield a écrit : > > > Greetings, denizens of Internals! > > > > > > Ilija Tovilo and I have been working for the last few months on adding > support for enumera

Re: [PHP-DEV] [RFC] Enumerations

2020-12-07 Thread Olle Härstedt
Did you discuss exhaustiveness checking already? On Sat, 5 Dec 2020, 00:25 Larry Garfield, wrote: > Greetings, denizens of Internals! > > Ilija Tovilo and I have been working for the last few months on adding > support for enumerations and algebraic data types to PHP. This is a > not-small task

Re: [PHP-DEV] [RFC] Enumerations

2020-12-07 Thread Max Semenik
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:2

Re: [PHP-DEV] [RFC] Enumerations

2020-12-07 Thread tyson andre
Hi Nikita, > > At present, no.  They're "just" objects, and you can't assign an object > > to a constant.  Unfortunately I'm not sure how to enable that without > > making them not-objects, which introduces all sorts of other complexity. > > This should at the least be clarified in the RFC. Is thi

Re: [PHP-DEV] [RFC] Enumerations

2020-12-07 Thread Larry Garfield
On Mon, Dec 7, 2020, at 9:56 AM, Rowan Tommins wrote: > On 07/12/2020 15:26, Larry Garfield wrote: > > Assuming it's feasible to do, what do people feel about supporting that? > > IMO, cases(), from(), and values() need to be kept no matter what as > > they're more self documenting and can be pa

Re: [PHP-DEV] [RFC] Enumerations

2020-12-07 Thread Rowan Tommins
On 07/12/2020 15:26, Larry Garfield wrote: Assuming it's feasible to do, what do people feel about supporting that? IMO, cases(), from(), and values() need to be kept no matter what as they're more self documenting and can be passed around as callables. So the question is just whether we sho

[PHP-DEV] Re: [RFC] Phasing out Serializable

2020-12-07 Thread Nikita Popov
On Mon, Dec 7, 2020 at 3:49 PM Björn Larsson wrote: > Den 2020-12-07 kl. 15:11, skrev Nikita Popov: > > > Hi internals, > > > > Picking up a loose thread: > > https://wiki.php.net/rfc/custom_object_serialization introduced a > > replacement for Serializable in PHP 7.4, so it's time to think about

Re: [PHP-DEV] [RFC] Enumerations

2020-12-07 Thread Pierre R.
Le 07/12/2020 à 16:26, Larry Garfield a écrit : On Mon, Dec 7, 2020, at 2:46 AM, Michał Marcin Brzuchalski wrote: Thanks for taking the topic. I love it. Regarding the `::cases()` method on UnitEnum I guess it'd be more natural to cast enum into an array like: (array) Suit; but I realize it'

Re: [PHP-DEV] [RFC] Enumerations

2020-12-07 Thread Larry Garfield
On Mon, Dec 7, 2020, at 2:46 AM, Michał Marcin Brzuchalski wrote: > Hi Larry, > > Thanks for taking the topic. I love it. > > Regarding the `::cases()` method on UnitEnum I guess it'd be more natural > to cast enum into an array like: > > (array) Suit; > > but I realize it'd be harder to imple

[PHP-DEV] Re: [RFC] Phasing out Serializable

2020-12-07 Thread Björn Larsson
Den 2020-12-07 kl. 15:11, skrev Nikita Popov: Hi internals, Picking up a loose thread: https://wiki.php.net/rfc/custom_object_serialization introduced a replacement for Serializable in PHP 7.4, so it's time to think about deprecating and removing the old mechanism: https://wiki.php.net/rfc/pha

[PHP-DEV] [RFC] Phasing out Serializable

2020-12-07 Thread Nikita Popov
Hi internals, Picking up a loose thread: https://wiki.php.net/rfc/custom_object_serialization introduced a replacement for Serializable in PHP 7.4, so it's time to think about deprecating and removing the old mechanism: https://wiki.php.net/rfc/phase_out_serializable This RFC follows a rather co

Re: [PHP-DEV] [RFC] Enumerations

2020-12-07 Thread Nikita Popov
On Sat, Dec 5, 2020 at 12:25 AM Larry Garfield wrote: > Greetings, denizens of Internals! > > Ilija Tovilo and I have been working for the last few months on adding > support for enumerations and algebraic data types to PHP. This is a > not-small task, so we've broken it up into several stages.

Re: [PHP-DEV] [RFC] Enumerations

2020-12-07 Thread Brent Roose
Hi Larry and Ilja It's great to see you're looking into enums, thanks! I have a few considerations from a userland point of view. I've been maintaining a userland enum implementation for a while now [1] so I think I share a thing or two about my experience. - Scalar enums are spot on, exactly

Re: [PHP-DEV] [RFC] Enumerations

2020-12-07 Thread Rowan Tommins
On 07/12/2020 01:00, Paul Crovella wrote: Instance state being global is a well-known problem with singletons. Maybe don't use singletons then. Or simply document them as was done in the RFC. I'd prefer the former since singletons don't seem to buy much here but problems, though maybe I'm missing

Re: [PHP-DEV] [RFC] Enumerations

2020-12-07 Thread Michał Marcin Brzuchalski
Hi Larry, sob., 5 gru 2020 o 00:25 Larry Garfield napisał(a): > Greetings, denizens of Internals! > > Ilija Tovilo and I have been working for the last few months on adding > support for enumerations and algebraic data types to PHP. This is a > not-small task, so we've broken it up into several

Re: [PHP-DEV] [RFC] Enumerations

2020-12-07 Thread Pierre R.
Le 07/12/2020 à 02:00, Paul Crovella a écrit : On Sun, Dec 6, 2020 at 7:12 AM Rowan Tommins wrote: Longer term plans are irrelevant except to avoid inadvertently shutting the door on something. This RFC is up for discussion, and will be up for voting, in isolation. It has to be able to stand on