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

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

Reply via email to