Setting aside difficulty of implementation, I'm coming around to the idea, though I think you could simplify it by cordoning off an entire namespace. E.g.:
A namespace at least two deep (e.g. \A\B\) may be marked 'protected' (by some method TBD). Classes and functions declared in a protected namespace can only be accessed from methods or functions inside the same namespace, or in ancestor namespaces.
E.g., if \Foo\Internal\ is protected, access of its classes/functions must originate from classes/functions defined in \Foo\, \Foo\Internal\, or \Foo\Internal\*.
This would allow something like nested classes, but obviously with a lot more flexibility.
In practice, plugin code sitting in, say, \MyPlugin\ could freely access \Framework\SomeClass, but not \Framework\Internal\SomeClass.
I see some value there, but there's tons of questions remaining and how to to implement the damn thing...
Steve Clay
--
http://www.mrclay.org/
On 2/28/13 1:56 AM, Jens Riisom Schultz wrote:
> * In response to the argument that php has no assembly concept:
> I know this, but namespaces are as close as we get, and would effectively solve this.