Re: [PHP4BETA] Session: objects containing objects
| From: | Ulf Wendel | Date: | Thu, 24 Feb 2000 16:37:48 +0000 |
| Subject: | Re: [PHP4BETA] Session: objects containing objects | ||
| References: | 1 2 3 4 5 6 | Groups: | php.version4 |
| Request: | Send a blank email to php-version4+get-10872@lists.php.net to get a copy of this message | ||
Andrei Zmievski wrote:
>
> On Thu, 24 Feb 2000, Ulf Wendel wrote:
> > get_member_vars() sounds good, although I prefer slots or fields.
> Ok, just a little more thinking. Do you really need a function? Can't
> you use foreach() or each() to iterate over them?
Yes, I can. But as far as I know this feature is not documented
and more important will PHP5 beahave the same way?
I asked this question already in my initial posting and it's
still unanswered. I think it's time to stop with this dirty hack
and to introduce some new functions for basic introspection.
When will you need them?
- user side serialization
- debugging
- ...
Are there's features php guys use? Yes. Think of requestion on
mailing lists, use groups and other forums about php object.
User side serialization is not really effective nor should a
functions be introduced only for this purpose.
Debugging of objects could be done another way. For example by
providing an always present super function to_string( object
$obj) that prints all methods, class vars, the name of the
childs, the parent, the own name and other information about an
object.
But we already implemented get_class() and get_parent_class() so
tell one good reasons not to make the familiy complete. Why not
implement get_member_vars (get_class_vars?) ? I would like to see
php to break with hacks. It's not very common that you can tread
an object like an array. An object is completely different from
an array, isn't it?
I think the language will get clearer with a new function
get_class_vars().
Convinced?
Ulf
--
Ulf Wendel
NetUSE Kommunikationstechnologie GmbH
Siemenswall, D-24107 Kiel, Germany
Fon: +49 431 386435 00 -- Fax: +49 431 386435 99