Re: Why are the PHP namespaces different compared to C++?
| From: | Sherif Ramadan | Date: | Fri, 07 Sep 2012 00:42:36 +0000 |
| Subject: | Re: Why are the PHP namespaces different compared to C++? | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-62883@lists.php.net to get a copy of this message | ||
On Thu, Sep 6, 2012 at 8:37 PM, Stas Malyshev <smalyshev@sugarcrm.com> wrote:
> Hi!
>
>> Yes, PHP namespaces are completely different from what you'd be used
>> to in C++. In all honesty namespaces were never well designed in PHP
>> and were implemented in a haphazard way, which is why I generally
>> don't bother using them.
>
> I just love how people assume if something does not fit their specific
> use case people implementing it must be stupid and didn't bother to
> actually think about it. If only they gave it some though, they would
> definitely would do it exactly as you want.
I wasn't assuming. I was outright making a factual statement. I never
made any implications of the intellectual levels of those implementing
the spec. I understand the RFC full well and know why the design is
the way it is. I was answering the ops question. Please read what I
said before you make your own assumptions.
>
>> To clarify, importing namespaces in PHP isn't like importing
>> namespaces in C++ at all, really. You are merely aliasing namespaces
>
> There's no importing namespaces in PHP, period. It is not "messy", it is
> by design, and if you bothered to read extensive discussions that
> happened on the list at the time, you'd know why. But of course who
> needs that.
Right, that's exactly what I said. Thanks for reiterating.
>
>> It simply doesn't work like that because PHP's namespaces are
>> implemented in such a way that they don't really resemble namespaces.
>
> They do not resemble namespaces in C++. They resemble namespaces in PHP.
> That's because PHP is not C++.
>
Sure, I just said that. Albeit I said it a more indirect manner.
> --
> Stanislav Malyshev, Software Architect
> SugarCRM: http://www.sugarcrm.com/
> (408)454-6900 ext. 227