SESS: objects containing objects *final statement*(?) please read!
| From: | Boris Erdmann | Date: | Fri, 25 Feb 2000 08:44:48 +0000 |
| Subject: | SESS: objects containing objects *final statement*(?) please read! | ||
| Groups: | php.version4 | ||
| Request: | Send a blank email to php-version4+get-10925@lists.php.net to get a copy of this message | ||
Now,
as i see it, all question Ulf had turned out to be documentation issues.
So lets put it together:
a) $obj1->obj2->obj3->etc un/serialization works to certain depths
b) On unserialization ** the constructor does not get recalled **
c) there exist ways to operate on objects:
- each()/foreach() to traverse an object's slots
- gettype to get to know an object's slot data type
- get_class to get an objects classname
These functions operate from "outside the object" in contrast
to an inside view like $this->slot->type() or $this->class_name().
(The outside approach is good for an outside serializer but makes it
difficult to make an object serialize itself).
These things should be mentioned somewhere in the documentation maybe
as a technote on the session docs.
Especially the implications of b) should be made clear:
Object serialization focuses on an object's slot state before and after
un/serializing. No new computations take place on unserialization.
Thus global impacts from method calls get lost.
Finnaly the question arose if it would be nice to have in addition
the ability to traverse an object's original slots. Lets put it
right:
This would be the ability to traverse the slots of a class. IHMO
Yes it would be nice to have *three* functions:
- class_member_vars("classname")
which implies class_member_vars(get_class($obj)) (the original
question from Andrei)
- class_methods("classname")
- get_superclass("classname")
This would make it possible for an object to get an idea of who
he/she is. Even if the funtions have outside view semantics :-)
Boris
--
Why, oh why, didn't i take the blue pill ?!! [Matrix]