Re: [RFC] Enumerations
| From: | Rowan Tommins | Date: | Sat, 05 Dec 2020 15:47:07 +0000 |
| Subject: | Re: [RFC] Enumerations | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-112429@lists.php.net to get a copy of this message | ||
On 05/12/2020 15:08, Larry Garfield wrote:
I guess what it comes down to is whether / how easily a class can return an existing instance when asked to unserialize, rather than setting properties on an existing instance. That is, given the string "C:4:Suit:6:{Spades}" can the class definition return the appropriate singleton for Suits::Spades rather than a newly constructed object? If this proves tricky to implement, it would probably be better to forbid serialization than using the default object format and breaking the singleton-ness of the case objects. Regards, -- Rowan Tommins (né Collins) [IMSoP]* Are cases serializable?Right now they'd do the same as objects, so they'd serialize as an object. Unserializing like that, though... hm, that would probably NOT still be === due to the way PHP handles objects. That's probably undesireable, but I'm not sure at the moment the best way around that. I'll have to discuss with Iliya.Suit::Spades === unserialize(serialize(Suit::Spades)) // true