Re: [PHP4BETA] Session: objects containing objects

From: Date: Thu, 24 Feb 2000 21:35:47 +0000
Subject: Re: [PHP4BETA] Session: objects containing objects
References: 1 2 3 4 5 6 7 8 9 10  Groups: php.version4 
Request: Send a blank email to php-version4+get-10898@lists.php.net to get a copy of this message
Andrei Zmievski wrote: > class foo { > var $bar; > } > > $a = new foo; > get_class_vars($a); // will return array("bar"). > > $a->baz = 1; > get_class_vars($a); // will return array("bar", "baz") > > See the difference? Default properties are those that are defined at > class declaration time. Then you can also add other properties. Yes I already got what you mean. But there's no reason to distinguish beetween them, is there? PHP doesn't even care that you break encapsulation with the above code, so why start to distinguish beetween different favours of slots. Think of what this function is used for. Manly for debugging as replacement of the foreach($obj) construct. Would you like to know about the properties defined when the object was constructed or all properties? The answer is obvious: all. If php knew static, private, public etc. it's worth to think of treating the slots different, accessing them by different functions or one that informs you about the nature of a certain slot. Before you start coding have a look to what I wrote in response to Boris. I'd like us to choose beetween eighter implementing functions for introspection or be able to handle an object like an array. Let's stop mixing both. Ulf

« previous php.version4 (#10898) next »