Re: [RFC] Property Accessors 1.2 : Shadowing
| From: | Clint Priest | Date: | Sun, 28 Oct 2012 00:32:39 +0000 |
| Subject: | Re: [RFC] Property Accessors 1.2 : Shadowing | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-63676@lists.php.net to get a copy of this message | ||
Sorry I guess I should have been more clear. The recursion would prevent the accessor from being called which would allow the ordinary property code to execute, thus accessing the property directly. I suppose if it were in a setter and the property were not defined by the accessor then it would automagically create a public property, not that it would matter if accessors always shadowed properties because the access control of the accessor would still prevail.
But it could be written such that an accessor would define a private property upon set from within the setter.
Recursion guarding in this case simply means that the get/set is guarded from being called more than once. It's the same mechanism that __get and __set use.
On Saturday, October 27, 2012 3:20:38 PM, Stas Malyshev wrote:
Hi!-- -ClintRecursion is guarded by the same mechanism __get uses to avoid recursion.__get on recursion returns undefined, __set on recursion does nothing. However you're saying "No direct access to the property would be allowed except from within the accessor" - but what this not allowing means? Just returning undefined if __getHours was previously called?