Re: Namespace access modifiers
| From: | Ralph Schindler | Date: | Thu, 13 Dec 2007 04:40:31 +0000 |
| Subject: | Re: Namespace access modifiers | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-33984@lists.php.net to get a copy of this message | ||
Jeff Moore wrote:
I don't think properties are the appropriate level to specify namespace based access modifiers. I do think that a coarse-grained access restriction on a class by class basis might be.Perhaps you are right, but I was using that as an example. I actually see great value in being able to declare a specific method inside a calls of a component/namespace as namespace-protected. Alot of times you see that objects within a given component might do something like: class Foo_Bar {
protected $_someProperty = null;
public function _setSomeProperty($value)
{
$this->_someProperty = $value
}
}
as a means to describe that an object of type Foo_Baz can interact with Foo_Bar, but Foo_Bar::_setSomeProperty() should not be considered a safe method to be called by a developer from an API standpoint.
Wouldn't that be nice?
pseudo-type? I just don't see how it could work in practice.Wouldn't it work the same way as protected methods work? Essentially, protected methods ensure that the caller is in the inheritance (is_a) chain. This would simple add a new check (for methods marked nsprotected) to check to ensure that the caller is a derivative of a specific namespace. -ralph