On 10/26/2012 6:37 PM, Stas Malyshev wrote:
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.
The only thing that does back patching is for static accessors and
you've already pointed out that what I was doing to make that happen is
just going to break and fail in so many ways.
What is "reflection hiding patches" referring to? Reflection is changed
to reflect what the user has defined, that's what reflection is supposed
to be.. no?
Lastly, this idea that accessors is such a foreign concept is a bit
ridiculous. You'd be hard pressed to find a modern/popular language
these days that doesn't have them, so if someone is confused about what
an accessor is then they probably have their head in the sand, god
forbid they'd have to read the manual.
--
-Clint
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php