Hi!

> v1.2 Proposes that this be inverted such that if there is an accessor 
> defined for a given property name, the accessor will always be used. The 
> accessor would be able to get/set/isset/unset the property with the same 
> name as the accessor. No direct access to the property would be allowed 
> except from within the accessor.

One of the deficiencies frequently mentioned for __get was "what if I
want to override access for existing variable?" Given that, I think
accessor priority is a good thing.
Now, with direct access from within the accessor it may get a bit
tricky, especially considering loops, etc. What would happen in the
scenario of __getHours calling foo() which does "return $this->Hours"?
Is __getHours called again? Is it a fatal error? Does it return
"undefined" like __get does?

> v1.2 proposal seems to make the most sense however it would incur a 
> slight (possibly *very* slight) performance penalty.

It may be an extra hash lookup, but if we could probably add the
existence of accessor (or maybe even pointer) into zend_property_info
then we wouldn't need the second hash lookup probably.
-- 
Stanislav Malyshev, Software Architect
SugarCRM: http://www.sugarcrm.com/
(408)454-6900 ext. 227

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to