Re: [RFC] Property Accessors v1.2 : Internal Accessor Method Visibility / Callability
| From: | Stas Malyshev | Date: | Fri, 26 Oct 2012 23:37:06 +0000 |
| Subject: | Re: [RFC] Property Accessors v1.2 : Internal Accessor Method Visibility / Callability | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-63659@lists.php.net to get a copy of this message | ||
Hi!
> Stas, if you define an accessor, how do you define it? Do you say
Either way, doesn't matter.
> According to the current proposal at least you can write the first
> code *and the first code only*. If you write the second code then you
That's where I think it is wrong. It would be much simpler and
consistent with existing PHP if it were a natural extension of __get
instead of a completely new and foreign concept.
> special behavior for properties. You probably won't start off with
> telling them that this declaration is automatically converted to a set
> of __getFoo methods which are registered as handlers for the accessor.
> I really don't see how going into details like __getFoo makes anything
> easier.
Depending on your purpose and background. If you know how __get works,
extrapolating to __getFoo is trivial. Getting special syntax that
produces __getFoo from this is also trivial.
Getting the concept of methods that are not quite methods and get called
only through special intercept mechanism and have special backtrace
rewriting engine and reflection hiding patches so you can be inside the
method that officially does not exist - not so trivial.
--
Stanislav Malyshev, Software Architect
SugarCRM: http://www.sugarcrm.com/
(408)454-6900 ext. 227