Re: [RFC] Enumerations
| From: | Larry Garfield | Date: | Sun, 06 Dec 2020 15:48:34 +0000 |
| Subject: | Re: [RFC] Enumerations | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-112443@lists.php.net to get a copy of this message | ||
On Sun, Dec 6, 2020, at 9:11 AM, Rowan Tommins wrote:
> Note that Larry's longer term plan is for "algebraic data types",
> including "tagged unions":
> https://wiki.php.net/rfc/adts Unlike
> straight-forward enum cases, these are not singletons, and each instance
> has its own associated state.
I was going to respond, but I think Rowan summed it up here. Stateful enums are called tagged
unions, and that's a separate phase to keep the implementation and discussion focused for now.
We hope to add those in the future, but for now unit and scalar enums have a ton of value unto
themselves.
--Larry Garfield