Re: I would like to write an RFC for the addition of an internal keyword

From: Date: Thu, 28 Feb 2013 20:37:18 +0000
Subject: Re: I would like to write an RFC for the addition of an internal keyword
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-66362@lists.php.net to get a copy of this message
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.




Thread (16 messages)

« previous php.internals (#66362) next »