Re: Why are the PHP namespaces different compared to C++?
| From: | Mark | Date: | Fri, 07 Sep 2012 17:24:52 +0000 |
| Subject: | Re: Why are the PHP namespaces different compared to C++? | ||
| References: | 1 2 3 4 5 6 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-62896@lists.php.net to get a copy of this message | ||
On Fri, Sep 7, 2012 at 8:22 AM, Lester Caine <lester@lsces.co.uk> wrote:
> Stas Malyshev wrote:
>>
>> Hi!
>>
>>> 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.
>>
>>
>> Sorry, statements like "haphazard way", "never well designed",
>> "it's a
>> mess", "they don't really resemble namespaces", "just some fancy
>> magic",
>> etc. have nothing to do with facts. Actually, facts are exactly the
>> opposite - they were designed, were extensively discussed with
>> soliciting feedback from many stakeholders, and were implemented exactly
>> as planned. You may not like the way there were implemented, that's your
>> opinion (not a fact) and you are entitled to it. But you didn't limit
>> yourself to saying "I don't like them". You specifically said that they
>> were never well designed and haphazardly implemented. This is factually
>> false.
>
>
> Stas ... One thing to bear in mind is that even for those of us for whom
> English is our only language it is sometimes difficult to explain what we
> mean. Sherif's were perhaps a little 'provocative' but were an accurate
> reflection of his view on the results of implementing namespaces. It is a
> compromise rather than something that sits naturally in PHP?
>
> What a lot of newcomers need to understand is that PHP is NOT compiled, so a
> heck of a lot of what they are used to just happening is physically
> impossible, and namespace is a good case in point. Personally I have yet to
> see a good example of the use of namespaces in third party libraries, and
> like Sherif avoid them preferring simply so that while the code may be more
> verbose, it's clear 5 years later what was intended :) A lot of the current
> 'magic' makes it difficult to pick up and work with other peoples code later
> on.
Right, i have to correct you there.
You don't explicitly say it, but you do think that i'm a "newcommer".
That's far from the truth. I've been using PHP since 2001 and i
consider myself to be quite advanced in PHP usage.
Back on the namespace topic. I won't judge on anything, but i know
namespaces from c++. I understand that PHP isn't a compiled language
and quite frankly that doesn't matter at all. What does matter is that
PHP uses the name: "namespace" which C++ obviously had earlier.
Naturally someone that knows both languaes (c++ and php) simply assume
that a namespace in php probably works the same as those in C++. If
that's not the case then it shouldn't even carry the "namespace" name.
To me this namespace in php stuff just looks like and alias. So why
isn't it named as that: "alias"? I do not want to question the ones
that implemented namespaces in php, but i do think that the name
itself is at the very least confusing.
Also, lets keep this discussion polite people. I'm not here to smash
toes. All i would like to know is the reasoning behind the above and
if there is any intention of changing the namespaces to be more c++
like.
Cheers,
Mark