Re: do_declare_property()

From: Date: Wed, 12 Jul 2000 15:20:18 +0000
Subject: Re: do_declare_property()
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-24324@lists.php.net to get a copy of this message
You can find the class the object was instanctiated from right? (var_dump an object, you'll see..) class ThisIsAClass { } $ThisIsAnObject = new ThisIsAClass; var_dump($ThisIsAnObject) This is pretty much the same right as function foo (class MyObject $obj) { } You could use this in a C function.. CaPS On Wed, 12 Jul 2000, Andi Gutmans wrote: > At 16:13 12/07/00 +0300, Teodor Cimpoesu wrote: > >Hi Andi! > >On Wed, 12 Jul 2000, Andi Gutmans wrote: > > > > > Yeah but I assume python *knows* what type z is at compile time, right? > > > > > > Andi > >uhm, what for? > >Of course it will know it's a class, and when parsing the class def. > >the rewrite takes place. > > > >Of course, we don't really need to have `$this->__bar', I though we > >can also have private var $bar', and rewrite the member to > >_Class__bar' > >to ensure it's `privateness'. > > I think you missed what I said. > Consider the following example: > function foo($obj) > { > $obj->bar; > } > > You have no idea what type (and/or class type) $obj is at compile-time. > So you can't know if $obj's bar property is private or not. > However, if you'd have the following syntax: > function foo(class MyObject $obj) > { > $obj->bar; > } > You could know at compile time if the MyObject class's bar member was > defined as private. > > Andi > --- > Andi Gutmans <andi@zend.com> > http://www.zend.com/ > > -- > PHP Development Mailing List <http://www.php.net/> > To unsubscribe, e-mail: php-dev-unsubscribe@lists.php.net > For additional commands, e-mail: php-dev-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.dev (#24324) next »