Re: do_declare_property()

From: Date: Wed, 12 Jul 2000 13:01:35 +0000
Subject: Re: do_declare_property()
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-24295@lists.php.net to get a copy of this message
in zend_execute.c > static inline zval **zend_fetch_property_address_inner(HashTable *ht, znode *op2, temp_variable *Ts, int type ELS_DC) Does the actual retrieving.. You can check wether the asked variable has '__' in front of it there.. Gotta move it though, now it also dies if the variable doesn't exist:-) Except for that.. it works... I just tested it on a "relative" big class of mine and it seems to work okey.... On Wed, 12 Jul 2000, Andi Gutmans wrote: > It won't be too easy to know in run-time if what you wrote was $this->__foo > or $a->__foo. > Also this looks pretty hackish to me and I'm not sure how well it would > actually propogate throughough PHP. > Andi > > At 14:38 12/07/00 +0200, Mathieu Kooiman (ggInternet) wrote: > >No need to know what type it is, > > if (prop_ptr->value.str.val[0] == '_' && > > prop_ptr->value.str.val[1] == '_') > > // assume its private. > > > >Just make sure ppl know its there. > > > >CaPS > > > >On Wed, 12 Jul 2000, Andi Gutmans wrote: > > > > > Yeah but I assume python *knows* what type z is at compile time, right? > > > > > > Andi > > > > > > At 14:41 12/07/00 +0300, Teodor Cimpoesu wrote: > > > >Hi Zeev! > > > >On Wed, 12 Jul 2000, Zeev Suraski wrote: > > > > > > > > > A good start would be knowing how you implemented these access control > > > > > modifiers. As far as I can tell there's no real transparent way of > > doing > > > > > this without either slowing Zend down considerably, or consuming > > > > roughly 2x > > > > > memory (even if you don't use objects). > > > > > > > > >BTW, in Python, the trick is a rewrite of the variable names. > > > >The convention is that private members to start with (least) 2 `__' : > > > >e.g. > > > >class Foo: > > > > def __init__(self,b): > > > > self.__bar = b > > > > def getBar(self): > > > > return self.__bar > > > >z = Foo(1) > > > >print z.getBar() > > > > > > > >for the private variable __bar, Python rewrites it to _Foo__bar > > > > > > > >-- teodor > > > > > > > >-- > > > >PHP Development Mailing List <¡òoyuKQ…ÒyÂOi > > > >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 > > > > > > --- > > > 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 > > > > > --- > Andi Gutmans <andi@zend.com> > http://www.zend.com/ >

« previous php.dev (#24295) next »