Re: Desired namespace behavoir

From: Date: Thu, 01 Dec 2005 16:42:22 +0000
Subject: Re: Desired namespace behavoir
Groups: php.internals 
Request: Send a blank email to internals+get-20961@lists.php.net to get a copy of this message
> /* > * this encounters a namespace. The auto-prefix-import option > * is active so EVERYTHING is inside the namespace is imported > * with a prefix of "JessieStuff_". > */ > require 'JessiePackage.php'; > $x=new JessieStuff_SimpleClass(); So let's say we've got a package like this: namespace JessieStuff { class FirstClass { ... } class SecondClass { public $obj; function __construct() { $this->obj = new FirstClass(); } } } Now we'd import this with prefixing everything and the result would be something that acts like: class JessieStuff_FirstClass { ... } class JessieStuff_SecondClass { public $obj; function __construct() { $this->obj = new FirstClass(); } } Then, if I do: $x = new JessieStuff_SecondClass(); I'd get an error that 'FirstClass' can't be found. Because it's renamed to JessieStuff_FirstClass. Or do you suggest we replace all occurences of 'new ClassName()' to 'new JessieStuff_ClassName()' as well? Or do you suggest that everything that was inside the namespace is still able to call "internal" classes without using the namespace prefix? And your INI option only provides interface classes?

« previous php.internals (#20961) next »