Re: RFC: Anonymous Classes
| From: | Sebastian Krebs | Date: | Mon, 23 Sep 2013 14:51:20 +0000 |
| Subject: | Re: RFC: Anonymous Classes | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-69274@lists.php.net to get a copy of this message | ||
2013/9/23 Joe Watkins <krakjoe@php.net>
> On 09/23/2013 02:43 PM, Lars Strojny wrote:
>
>> Hi Joe,
>>
>> what about serialization for those classes?
>>
>> cu,
>> Lars
>>
>> Am 23.09.2013 um 08:39 schrieb Joe Watkins <krakjoe@php.net>:
>>
>> Morning All,
>>>
>>>
>>> https://wiki.php.net/rfc/**anonymous_classes<https://wiki.php.net/rfc/anonymous_classes>
>>>
>>> I'd like to hear thoughts regarding the addition of anonymous
>>> classes, patch included.
>>>
>>> Cheers
>>> Joe
>>>
>>> --
>>> PHP Internals - PHP Runtime Development Mailing List
>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>>
>>>
>>
> Same as any other object; what you are creating is normal classes without
> a (declared) name, nothing about the objects functionality has differs from
> an object of a named class.
>
When you serialize an object the serialized form contains the class name.
So as long as the instance doesn't have a own class name it isn't possible
to serialize it properly and even further to unserialize it, because the
whole definition is gone. To sum it up: They aren't serializable.
Imo it isn't such a flaw, that anonymous instances aren't serializable,
because anonymous functions/closures aren't neither.
Regards,
Sebastian.
>
> Cheers
>
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
github.com/KingCrunch