Re: [RFC] Property Accessors v1.2 : Internal Accessor Method Visibility / Callability
| From: | Clint Priest | Date: | Sat, 27 Oct 2012 18:05:27 +0000 |
| Subject: | Re: [RFC] Property Accessors v1.2 : Internal Accessor Method Visibility / Callability | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-63669@lists.php.net to get a copy of this message | ||
That's why I think they shouldn't even be visible to users, they aren't relevant to them and in fact it could mis-lead them into thinking that they could simply define __getHours() and expect $foo->Hours to call it, which it wouldn't.
To me, the bottom line is, the fact that there are methods defined by accessors is an engine detail and not something that should be exposed to the user.
As for the __set_state() issue, I can see the need to change the pattern of method naming, I'd be amenable to anything.
Everyone okay with __get_prop_hours() naming convention then?
On Saturday, October 27, 2012 3:01:39 AM, Patrick Schaaf wrote:
-- -ClintNeeding an "except" is inelegant, if it can be avoided up front. Also, having __prop_get_XXX etc. is a bit more descriptive to somebody later "wondering" what these methods are - prop alludes to properties, which is what the methods are about. I can already see the stack overflow subject, "what are these __prop methods in new PHP" :) best regards Patrick- i.e. name them __prop_get_xxx, __prop_set_xxx, and so on.I think it'd more natural to make it __set__PROPNAME. Though __set_state is a static method, so maybe we can live with it - except that you won't be able to declare property named $_state.