Re: Serializing references - part I
| From: | Sascha Schumann | Date: | Tue, 24 Oct 2000 10:20:25 +0000 |
| Subject: | Re: Serializing references - part I | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-36087@lists.php.net to get a copy of this message | ||
On Tue, 24 Oct 2000, Stanislav Malyshev wrote:
> SS>> HashTable var_hash;
> SS>>
> SS>> zend_hash_init(..);
> SS>> php_var_(un)serialize(..);
> SS>> zend_hash_destroy(..);
> SS>>
> SS>> we would use
> SS>>
> SS>> php_var_hash_t var_hash;
> SS>>
> SS>> var_hash = var_hash_init();
> SS>> php_var_(un)serialize(..);
> SS>> var_hash_destroy(var_hash);
>
> In fact, I do not see any difference. All the custom (for different
> serializers) code will go after hash init anyway. But I can make it, if
> you like, I only see no point in it.
Every instance of code calling php_var_(un)serialize will
have to initialize and destroy data structures.
Let us assume that a faster/better/whatever algorithm for
this references stuff would appear. The algorithm would need
to store additional data. Would you then want to add more
init/destroy stuff all over our codebase?
The point of the interface is to hide the implementation
details (aka abstraction).
> SS>> print serialize(&$c)."\n";
>
> Why call-time reference? I'm even not sure what it does, but you should
> not use it.
Why should not it work with your code?
> SS>> O:3:"foo":2:{s:2:"ok";s:3:"yes";}
>
> This is wrong result, for me it gives:
>
>
> O:3:"foo":2:{s:2:"ok";s:3:"yes";s:1:"n";O:3:"foo":2:{s:2:"ok";R:2;}}
>
> Which, btw, is wrong too - should be R:1. More work is needed on ot.
- Sascha