Robert, please keep it on list, no need to email me personally.

You would most likely not be both using a Session class but more over
what if we made to different classes that performed quite different
tasks, but for some reason or another we called named them the same.
That is the true reason for Namespaces.  Your statement of:

PHP doesn't support namespaces; however, functions defined within a 
> class definition are essentially conform to namespace ideology since 
> the function would need to be defined twice in the same class to cause

> an collision.

Does not make sense this is not a namespace ideology at all it is called
encapsulation.  This is what threw me off.  Sorry to affend you:

<quote>
If they don't help clarify my point, then I'm afraid that I can't
clarify it any better for you and wish you luck in the future :)
</quote>

Regards,

Justin Palmer
IT Administrator
___________________________________
Council for Educational Travel, USA
1403 View Avenue
Centralia, WA 98531
USA



-----Original Message-----
From: Robert Cummings [mailto:[EMAIL PROTECTED] 
Sent: Monday, March 29, 2004 2:42 PM
To: [EMAIL PROTECTED]
Subject: RE: [PHP] Namespaces in PHP


On Mon, 2004-03-29 at 17:35, Justin Palmer wrote:
> Hi,
> 
> I don't see how you are saving any sort of collision at all with the 
> below, unless it is by chance.  Say that you and I are on different 
> teams within the same company.  Then you and I are put onto the same 
> team.  Both of us use our Session Class, named Session, out of our 
> toolkits. To build different pieces of a project that we are working 
> on. When we go to put it together our software blows up with 
> conflicting Object names.  The function within the class CAN have the 
> same names it is all about what you call the class.
> 
> I am confused into what you wrote below.  Please explain.

If you are working in your company and BOTH you and someone else are
both implementing a session class then you have an ifficient company.
That said my example was to illustrate how the functions defined within
classes avoid naming collisions with functions of the same name in other
classes. For instance:

class Session
{
    function getData( $key )
    {
        // Some code.
    }
}

class Cache
{
    function getData( $key )
    {
        // Some code.
    }
}

Obviously here the getData() functions don't collide because they are
encapsulated within their respective classes. These probably aren't the
best exmaples, but they should illustrate the point I was making. If
they don't help clarify my point, then I'm afraid that I can't clarify
it any better for you and wish you luck in the future :) As I said in my
original response this doesn't solve collisions with class names.

Cheers,
Rob.

> 
> Regards,
> 
> Justin Palmer
> IT Administrator
> ___________________________________
> Council for Educational Travel, USA
> 1403 View Avenue
> Centralia, WA 98531
> USA
> 
> 
> 
> -----Original Message-----
> From: Robert Cummings [mailto:[EMAIL PROTECTED]
> Sent: Monday, March 29, 2004 2:14 PM
> To: [EMAIL PROTECTED]
> Cc: PHP-General
> Subject: Re: [PHP] Namespaces in PHP
> 
> 
> On Mon, 2004-03-29 at 17:01, Justin Palmer wrote:
> > Hi,
> > 
> > I did not think that PHP supported namespaces?  I would love to see 
> > it
> 
> > if it is possible.  What sparked my interest was this post:
> > 
> > http://news.php.net/article.php?group=php.general&article=181728
> > 
> > <quote>
> > There are lots of other things, of course. One method of learning
> > about this would be to take every OO term (encapsulation,
namespacing,
> 
> > etc.) and find a really good explanation of the term. </quote>
> > 
> > Let me know.
> 
> PHP doesn't support namespaces; however, functions defined within a 
> class definition are essentially conform to namespace ideology since 
> the function would need to be defined twice in the same class to cause

> an collision. In practice this doesn't happen, hwoever the possiblity 
> for class names to collide is still an issue. Class names generally 
> collide less than raw functions. It is also useful to point out that a

> heirarchical naming scheme for functions provides the same benefit. 
> For instance contrast:
> 
> class Session
> {
>     function getData( $key )
>     {
>         // Some code.
>     }
> 
>     function setData( $key, $value )
>     {
>         // Some code.
>     }
> }
> 
> Versus the following function naming scheme:
> 
> function Session_getData( $sessResource, $key )
> {
>     // Some code.
> }
> 
> function Session_setData( $sessResource, $key, $value )
> {
>     // Some code.
> }
> 
> HTH and HAND and Cheers,
> Rob.
> --
> .------------------------------------------------------------.
> | InterJinn Application Framework - http://www.interjinn.com |
> :------------------------------------------------------------:
> | An application and templating framework for PHP. Boasting  | a
> | powerful, scalable system for accessing system services  | such as 
> | forms, properties, sessions, and caches. InterJinn |
> | also provides an extremely flexible architecture for       |
> | creating re-usable components quickly and easily.          |
> `------------------------------------------------------------'
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
> 
> 
> 
-- 
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting  | a 
| powerful, scalable system for accessing system services  | such as 
| forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for       |
| creating re-usable components quickly and easily.          |
`------------------------------------------------------------'

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to