Re: Re: Re: Re: __get() not reentrant?
| From: | Jochem Maas | Date: | Tue, 24 May 2005 11:55:57 +0000 |
| Subject: | Re: Re: Re: Re: __get() not reentrant? | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-215791@lists.php.net to get a copy of this message | ||
Christopher J. Bottaro wrote:
Richard Lynch wrote:and another thing, take this rather contrived/simple example of making set (as opposed to non-existent) [non-public] properties available via the property access syntax:On Sun, May 22, 2005 3:24 pm, Christopher J. Bottaro said:I completely disagree. I don't mean any offense to anyone here, but I find it kind of ridiculous for a language to restrict itself that like in this case. Its insulting to our intelligence as programmers.And what would make it any different from a normal recursive function?The fact that *ANY* attempt to access a mis-typed property would kick in a __get() call, and that's too frickin' easy to happen in code that's too easy to fly by QA in large-scale applications springs to mind... Not saying you're "wrong" or they're "right" just that it's not quite as simple as a normal recursive function or loop iteration.
public function __get($varName)
{
return isset($this->$varName) ? $this->$varName: null;
}
which would be impossible to do as is if __get() was 'reentrant' (whatever that means exactly,
we both/all at least know that we mean that you can call it recursively...)
actually if __get() worked in such a recursive way then it would be impossible to actually
access any properties of the object.
also note that __get() only comes into play if the property requested is not public or is not
set.....
the internals mailing list has stuff in the archives about __get() which probably explains
it a whole load better (including the reasoning behind the decisions etc etc) which may
be of interest to you.
these are not the droids your looking for, move along. :-)
-- C