> The point I'm trying to make is that an enum's normalized
> representation should be an integer, and that is also how it should be
> serialized. It also happens to be how most other languages chose to
> represent enums, and deviating from that will cause all kinds of pain
> the minute you need to do type conversions between formats or
> languages.

You can always serialize things however you want. Using `serialize()`
is just a convenience – there is absolutely nothing that prevents you
from using a custom serialization routine. Note that while Java has
built in serialization it is often not used, and instead libraries
like Google's GSON are used. You register a type with hooks for
serializing and deserializing, etc.

It sounds like this is what you need anyway. Since built-in
serialization happens differently in each language you'd probably want
something custom in each language.

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

Reply via email to