On 1 December 2010 10:38, Stas Malyshev <smalys...@sugarcrm.com> wrote: > So we have one set of properties where get and isset use different methods > and another set of properties where get and isset use same method but with > parameter. I think it's not the best way to go. It's better to ignore isset > altogether than this.
No. The prototype of all setters would be the same. As would the prototype of all getters. The prototype would be ... [public|protected|private] property $property { [public|protected|private] mixed|bool get([bool $isset = false]) { // mixed result for get, bool result for isset }, [public|protected|private] mixed|void set(mixed $value [, bool $unset = false]) { // mixed result for set, void result for unset }, }; >From a user's perspective ... echo isset($instance->property) ? 'isset to ' . $instance->property : 'not isset'; This would result in 2 calls ... property->get(true) // Let the getter that an attempt is being made to see if the property has been set. and property->get(false) // Let the getter know that the getter is expected to return the properties value. Similarly for the setter. $instance->property = 'foo'; unset($instance->property); would result in 2 calls ... property->set('foo', false) // Let the setter know that it should be setting the value of the property to 'foo'. and property->set(null, true) // Let the setter know that an attempt to unset the property has taken place. Maybe the proposal should be changed to ... [public|protected|private] property $property { [public|protected|private] mixed get() { }, [public|protected|private] mixed set(mixed $value) { }, [public|protected|private] bool isset() { }, [public|protected|private] void unset() { }, }; (NOTE: Add in abstract and final as appropriate). -- Richard Quadling Twitter : EE : Zend @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php