> What about UNserialize then?

I don't see any way to handle this sensibly, but I also don't regard this as
a
problem, because that's not what these anonymous classes are for. If you
want
something that can be unserialised into a thing with methods then logically
you
know what it is ahead of time, because you know what functionality you want
it
to have, so you would have a named class for it. If you don't want it to
have
methods then it's just a value object and stdClass will suffice (you
wouldn't
have created the anonymous class in the first place).

All? the use cases mentioned are centred around interfaces and interfaces
don't
include values (i.e. properties), which is all that serialisation stores
apart
from the class name, which by definition doesn't apply to anonymous classes.

The opposite of this problem, unserialising anonymous objects into instances
of
defined classes, would be very useful in many places (especially JSON) but I
guess that's another prickly issue for another thread.

To summarize how I think this should be handled: Serialisation results in a
stdClass, unserialisation cannot be done because if you want it you're
already
Doing It WrongT.


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

Reply via email to