Re: my last attempt at sanity with namespaces
| From: | Gregory Beaver | Date: | Fri, 17 Oct 2008 02:02:32 +0000 |
| Subject: | Re: my last attempt at sanity with namespaces | ||
| References: | 1 2 3 4 5 6 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-41190@lists.php.net to get a copy of this message | ||
Stanislav Malyshev wrote:
> Hi!
>
>> Yes, but most times when there is conflict it will be between two
>> sets of code. So importing someone else's namespace explicitly and
>> giving it a new name is a good call IMHO.
>
> If you have two distinct sets of code, why you use same namespace for
> both of them? Namespaces are specifically designed so you could have
> different sets of code in different places.
>
>> nb Stas - I asked the same question about warnings, Greg updated his
>> proposal since then to answer it.
>
> As it is now, every call to class::method() not accompanied with use
> should produce E_WARNING. I do not think it is an acceptable situation
> - this would make code migration a nightmare, since even if you never
> use functions and never even have any chance for a conflict, you still
> have to insert hundreds of imports into your code, just to shut up the
> warnings. I don't think it is a good idea. Feature that you do not
> need, can not disable and have to work around is called "bug".
Hi Stas,
This is not what is proposed. The E_WARNING is *only* on a name
conflict. Please re-read or try the patch:
http://pear.php.net/~greg/resolve_conflict.patch.txt
Greg