Re: Namespace access modifiers
| From: | Nathan Rixham | Date: | Thu, 13 Dec 2007 00:54:13 +0000 |
| Subject: | Re: Namespace access modifiers | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-33982@lists.php.net to get a copy of this message | ||
Would this not do the same thing and perhaps be easier to implement:
namespace Foo;
protected $var;
class Bar {
}
thus allowing use of private public protected before variables, and hell why not classes aswell.
private = only methods, code, classes in namespace Foo have access
protected = only methods, code, classes in namespace Foo or children Foo::Too have access
public = everybody
the same inheritance rules etc as classes.. makes sence :) and great idea!
got my vote, especially with the braces in namespaces!
namespace Foo; {
protected $var;
public class Extender {
public function __construct() {
......
}
}
}
Nathan
Ralph Schindler wrote:
Since everyone is in the "namespace" frame of mind, is there a possibility of a "namespace" access modifier? The way I envision this working is that if for example: namespace Foo; class Bar { nsprotected $_someProperty = null; } (or some other equivalent grammer) Would allow the property Foo::Bar::$_someProperty to be accessed from any class that has implemented a class from the Foo namespace. Reaching for straws or is this a possibility? -ralph