|
Posted by Steve on 09/28/07 14:09
"RageARC" <ragearc@gmail.com> wrote in message
news:1190987748.408888.185590@g4g2000hsf.googlegroups.com...
> On 27 Sep, 22:41, "Steve" <no....@example.com> wrote:
>> "RageARC" <rage...@gmail.com> wrote in message
>>
>> news:1190928786.269812.158460@57g2000hsv.googlegroups.com...
>>
>> >> namespaces are
>> >> invaluable, if you know what they are and how to use them.
>>
>> > Of course, that's what I've been asking since my first post :S.
>>
>> i know, i know...but with your last post re. collision, i think you
>> understand their primary function. now, it's understanding when using
>> them
>> will aid your development. i'd google the web, were i you. i'm not gunna
>> burn up my keyboard here over that part of the quandry. ;^)
>>
>> >> that is a primary benefit of a namespace, but certainly not the only
>> >> one.
>>
>> > Call me a hard headed guy, but that's the only one I saw from the
>> > posts I received from here:
>>
>> again, i defer to google. you'll get it.
>>
>> >>> What is it useful for?
>>
>> >> Preventing name collisions. Say, you need to use two third-party
>> >> libraries, and each of them contains a function named authenticate().
>>
>> cheers
>
> AHA I believe I found the trick:
>
> All PHP extensions have their functions with the prefix of the
> extension.
>
> curl_init...
> curl_exec...
> curl_close...
>
> This has a major drawback: The names of the functions become extremely
> big and that is completely useless. In C++ (I know that because I know
> C++, but I never used namespaces other than std), I would do the
> following:
>
> --
> using namespace curl;
>
> init...
> exec...
> close...
>
> --
>
> It's like with ZEND Framework (Just thought of that while reading
> their documentation):
>
> using namespace zend;
>
> And then all ZEND functions would not need ZEND prefixing them.
>
> That should be the best part, I guess. Completely separating EVERY
> single thing in a package to make it completely independent. That's
> what is wanted in OOP, and namespaces are not needed if you have only
> one class, but if you have 200 or 300, odds are they will clash with
> other classes from other libs or even classes made by the users.
;^)
[Back to original message]
|