On 18/09/2015 00:34, user@domain.invalid wrote:
Well, how are you supposed to serialize an enum value without some sort of numerical representation or value? Maybe you could serialize it by converting the enum to a string representation of its name but that wouldn't be efficient and also if a developer refactored its code base and renamed an enum, when unserializing the data it wouldn't be properly assigned.

I don't think serializing to a name is particularly more inefficient than serializing to an integer - depending on the internal implementation, of course. Or do you mean efficiency in terms of the length of the string produced?

Nor do I see it as particularly likely that somebody will rename an enum member - that would instantly break all code referring to it anyway. They could however change the order of fields without realising that it would make any difference, since most access would be of the form TypeName::ValueName.

Regards,

--
Rowan Collins
[IMSoP]


--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to