Namespaces in PHP5, removed?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Joshua Beall

    Namespaces in PHP5, removed?

    Hi All,

    I read in a forum somewhere that namespaces, though once supposed to be a
    part of PHP5, have been removed. Is this true? Can anyone show me the
    official statement by Zend that they decided to forget about namespaces?
    Why would they do this?

    I could really use namespaces. If they canned this idea, that is quite a
    disappointment :-/ Guess you cannot win them all.

    -Josh


  • Phil Roberts

    #2
    Re: Namespaces in PHP5, removed?

    With total disregard for any kind of safety measures "Joshua
    Beall" <jbeall@donotsp am.remove.me.he raldic.us> leapt forth and
    uttered:
    [color=blue]
    > Hi All,
    >
    > I read in a forum somewhere that namespaces, though once
    > supposed to be a part of PHP5, have been removed. Is this true?
    > Can anyone show me the official statement by Zend that they
    > decided to forget about namespaces? Why would they do this?
    >[/color]

    From the Zend changelog:

    Version 5.0.0 Beta 2
    30-Oct-2003
    Lots and lots of changes in the Zend Engine 2 since beta 1:
    * Removed the not so working namespaces support

    I've lost the links to the original reasonings given by Andi
    Gutmans and Zeev Suraski, but heres one link:




    --
    Phil Roberts | Nobody In Particular | http://www.flatnet.net/

    Comment

    • Chung Leong

      #3
      Re: Namespaces in PHP5, removed?

      Because it was pretty pointless that way it was implemented. You can't
      import names from a namespace, so everytime you use something from within
      it, you have to tag on the namespace identifier.

      Uzytkownik "Joshua Beall" <jbeall@donotsp am.remove.me.he raldic.us> napisal w
      wiadomosci news:iGNUb.1524 4$EH5.3281@nwrd dc01.gnilink.ne t...[color=blue]
      > Hi All,
      >
      > I read in a forum somewhere that namespaces, though once supposed to be a
      > part of PHP5, have been removed. Is this true? Can anyone show me the
      > official statement by Zend that they decided to forget about namespaces?
      > Why would they do this?
      >
      > I could really use namespaces. If they canned this idea, that is quite a
      > disappointment :-/ Guess you cannot win them all.
      >
      > -Josh
      >
      >[/color]


      Comment

      • Joshua Beall

        #4
        Re: Namespaces in PHP5, removed?

        "Chung Leong" <chernyshevsky@ hotmail.com> wrote in message
        news:ZYadnRmcsY 1zu7nd4p2dnA@co mcast.com...[color=blue]
        > Because it was pretty pointless that way it was implemented. You can't
        > import names from a namespace, so everytime you use something from within
        > it, you have to tag on the namespace identifier.[/color]

        That's too bad. I wonder, how well can I emulate namespaces using nested
        classes? Is there any way to "import" the contents of a class?


        Comment

        • Janwillem Borleffs

          #5
          Re: Namespaces in PHP5, removed?

          Joshua Beall wrote:[color=blue]
          > Hi All,
          >
          > I read in a forum somewhere that namespaces, though once supposed to
          > be a part of PHP5, have been removed. Is this true? Can anyone show
          > me the official statement by Zend that they decided to forget about
          > namespaces? Why would they do this?
          >[/color]

          Quote from http://www.php.net/ChangeLog-5.php (version 5.0.0 beta 2,
          30-Oct-2003):

          "Removed the not so working namespaces support"

          I don't know why exactly, but I have a feeling the developers wanted to
          focus on other parts of PHP 5 instead.


          JW



          Comment

          • Chung Leong

            #6
            Re: Namespaces in PHP5, removed?

            Personally, I never liked namespace. Its need is understandable in C++,
            where you link in binary libraries and there's no other workaround for name
            collisions. With PHP you can just rename the class/function. And namespace
            promotes bloated class libraries, which affects runtime performance in PHP.
            When the number of classes is large enough where name collision is an issue,
            you scripts are probably all crawling.

            Uzytkownik "Joshua Beall" <jbeall@donotsp am.remove.me.he raldic.us> napisal w
            wiadomosci news:kLVUb.1564 5$9a7.7081@nwrd dc02.gnilink.ne t...[color=blue]
            > "Chung Leong" <chernyshevsky@ hotmail.com> wrote in message
            > news:ZYadnRmcsY 1zu7nd4p2dnA@co mcast.com...[color=green]
            > > Because it was pretty pointless that way it was implemented. You can't
            > > import names from a namespace, so everytime you use something from[/color][/color]
            within[color=blue][color=green]
            > > it, you have to tag on the namespace identifier.[/color]
            >
            > That's too bad. I wonder, how well can I emulate namespaces using nested
            > classes? Is there any way to "import" the contents of a class?
            >
            >[/color]


            Comment

            • Alex Farran

              #7
              Re: Namespaces in PHP5, removed?

              Chung Leong writes:
              [color=blue]
              > Personally, I never liked namespace. Its need is understandable in C++,
              > where you link in binary libraries and there's no other workaround for name
              > collisions. With PHP you can just rename the class/function.[/color]

              You mean search and replace for every occurance of the duplicate
              class? It's feasible, but not always very practical, and you need to
              know that a name collision exists to begin with. The best practical
              alternative to namespaces is a class naming convention, and that has
              its own problems.
              [color=blue]
              > And namespace promotes bloated class libraries, which affects
              > runtime performance in PHP. When the number of classes is large
              > enough where name collision is an issue, you scripts are probably
              > all crawling.[/color]

              Only if you include them all at once. You could have a vast library
              of classes available, but only include the ones you need as you need
              them. Or leave it to the optimiser to cache your classes. For PHP to
              be taken seriously as an enterprise programming language, it must be
              possible to write large systems in it. Namespaces make large systems
              easier to write.

              Apart from name collision prevention, namespaces also provide another
              scope for class member access. Classes in the same namespace can
              access each others members, but deny access to classes outside the
              namespace. Without namespaces you must declare such members public
              and hope for the best.

              --

              __o Alex Farran
              _`\<,_ Analyst / Programmer
              (_)/ (_) www.alexfarran.com

              Comment

              • Chung Leong

                #8
                Re: Namespaces in PHP5, removed?

                Being a incorrigible PHP Maoist, I say down with class hierarchy and screw
                private variable.

                Long live the global scope!

                Uzytkownik "Alex Farran" <alex@alexfarra n.com> napisal w wiadomosci
                news:m3znbuskin .fsf@alexfarran .com...[color=blue]
                > Chung Leong writes:
                >[color=green]
                > > Personally, I never liked namespace. Its need is understandable in C++,
                > > where you link in binary libraries and there's no other workaround for[/color][/color]
                name[color=blue][color=green]
                > > collisions. With PHP you can just rename the class/function.[/color]
                >
                > You mean search and replace for every occurance of the duplicate
                > class? It's feasible, but not always very practical, and you need to
                > know that a name collision exists to begin with. The best practical
                > alternative to namespaces is a class naming convention, and that has
                > its own problems.
                >[color=green]
                > > And namespace promotes bloated class libraries, which affects
                > > runtime performance in PHP. When the number of classes is large
                > > enough where name collision is an issue, you scripts are probably
                > > all crawling.[/color]
                >
                > Only if you include them all at once. You could have a vast library
                > of classes available, but only include the ones you need as you need
                > them. Or leave it to the optimiser to cache your classes. For PHP to
                > be taken seriously as an enterprise programming language, it must be
                > possible to write large systems in it. Namespaces make large systems
                > easier to write.
                >
                > Apart from name collision prevention, namespaces also provide another
                > scope for class member access. Classes in the same namespace can
                > access each others members, but deny access to classes outside the
                > namespace. Without namespaces you must declare such members public
                > and hope for the best.
                >
                > --
                >
                > __o Alex Farran
                > _`\<,_ Analyst / Programmer
                > (_)/ (_) www.alexfarran.com
                >[/color]


                Comment

                • Tim Tyler

                  #9
                  Re: Namespaces in PHP5, removed?

                  Alex Farran <alex@alexfarra n.com> wrote or quoted:
                  [color=blue]
                  > For PHP to be taken seriously as an enterprise programming language, it
                  > must be possible to write large systems in it. Namespaces make large
                  > systems easier to write.[/color]

                  Yes - exactly.

                  Still - PHP has some other problems - as a result of being hastily hacked
                  together - I can imagine why the developers might want to focus on those ;-)
                  --
                  __________
                  |im |yler http://timtyler.org/ tim@tt1lock.org Remove lock to reply.

                  Comment

                  • Tony Marston

                    #10
                    Re: Namespaces in PHP5, removed?


                    "Alex Farran" <alex@alexfarra n.com> wrote in message
                    news:m3znbuskin .fsf@alexfarran .com...[color=blue]
                    > Chung Leong writes:
                    >[color=green]
                    > > Personally, I never liked namespace. Its need is understandable in C++,
                    > > where you link in binary libraries and there's no other workaround for[/color][/color]
                    name[color=blue][color=green]
                    > > collisions. With PHP you can just rename the class/function.[/color]
                    >
                    > You mean search and replace for every occurance of the duplicate
                    > class? It's feasible, but not always very practical, and you need to
                    > know that a name collision exists to begin with. The best practical
                    > alternative to namespaces is a class naming convention, and that has
                    > its own problems.[/color]

                    Naming conventions require intelligence, which sadly is in short supply.
                    [color=blue][color=green]
                    > > And namespace promotes bloated class libraries, which affects
                    > > runtime performance in PHP. When the number of classes is large
                    > > enough where name collision is an issue, you scripts are probably
                    > > all crawling.[/color]
                    >
                    > Only if you include them all at once. You could have a vast library
                    > of classes available, but only include the ones you need as you need
                    > them. Or leave it to the optimiser to cache your classes. For PHP to
                    > be taken seriously as an enterprise programming language, it must be
                    > possible to write large systems in it. Namespaces make large systems
                    > easier to write.[/color]

                    I have wriitten large systems in several languages which did not have
                    namespaces, so namespaces cannot be the only solution to that problem
                    (whatever the "problem" is). If you identified the problem correctly, then
                    perhaps a solution other than namespaces would present itself.

                    Tony Marston
                    This is Tony Marston's web site, containing personal information plus pages devoted to the Uniface 4GL development language, XML and XSL, PHP and MySQL, and a bit of COBOL

                    [color=blue]
                    > Apart from name collision prevention, namespaces also provide another
                    > scope for class member access. Classes in the same namespace can
                    > access each others members, but deny access to classes outside the
                    > namespace. Without namespaces you must declare such members public
                    > and hope for the best.
                    >
                    > --
                    >
                    > __o Alex Farran
                    > _`\<,_ Analyst / Programmer
                    > (_)/ (_) www.alexfarran.com
                    >[/color]


                    Comment

                    • Alex Farran

                      #11
                      Re: Namespaces in PHP5, removed?

                      Tony Marston writes:
                      [color=blue]
                      > I have wriitten large systems in several languages which did not have
                      > namespaces, so namespaces cannot be the only solution to that problem
                      > (whatever the "problem" is). If you identified the problem correctly, then
                      > perhaps a solution other than namespaces would present itself.[/color]

                      The problem is name collision, which is going to happen sooner or
                      later when you have more than one person working on a project,
                      possibly seperated by time and distance. You solve it by either
                      making sure each class and function has a unique name, ie using a
                      naming convention, or by using namespaces so it doesn't matter if they
                      don't.

                      If I write a library I have no way of knowing where that library is
                      going to be used, or which other librarys may be in use at the same
                      time. I need some way of ensuring that my class and function names
                      will not conflict with anyone elses.

                      --

                      __o Alex Farran
                      _`\<,_ Analyst / Programmer
                      (_)/ (_) www.alexfarran.com

                      Comment

                      • Alex Farran

                        #12
                        Re: Namespaces in PHP5, removed?

                        Sorry, typos.
                        [color=blue]
                        > If I write a library I have no way of knowing where that library is
                        > going to be used, or which other librarys may be in use at the same[/color]
                        libraries[color=blue]
                        > time. I need some way of ensuring that my class and function names
                        > will not conflict with anyone elses.[/color]
                        else's.


                        --

                        __o Alex Farran
                        _`\<,_ Analyst / Programmer
                        (_)/ (_) www.alexfarran.com

                        Comment

                        • Chung Leong

                          #13
                          Re: Namespaces in PHP5, removed?

                          Clearly, if a team of developers continually have name collisons, they are
                          not making any kind of effort to reuse each other's code. I don't see how a
                          project can suceed when there's such a massive communication problem.

                          Uzytkownik "Alex Farran" <alex@alexfarra n.com> napisal w wiadomosci
                          news:m3ekt4a17j .fsf@alexfarran .com...[color=blue]
                          > The problem is name collision, which is going to happen sooner or
                          > later when you have more than one person working on a project,
                          > possibly seperated by time and distance. You solve it by either
                          > making sure each class and function has a unique name, ie using a
                          > naming convention, or by using namespaces so it doesn't matter if they
                          > don't.
                          >
                          > If I write a library I have no way of knowing where that library is
                          > going to be used, or which other librarys may be in use at the same
                          > time. I need some way of ensuring that my class and function names
                          > will not conflict with anyone elses.
                          >
                          > --
                          >
                          > __o Alex Farran
                          > _`\<,_ Analyst / Programmer
                          > (_)/ (_) www.alexfarran.com
                          >[/color]


                          Comment

                          • Alex Farran

                            #14
                            Re: Namespaces in PHP5, removed?

                            Chung Leong writes:
                            [color=blue]
                            > Clearly, if a team of developers continually have name collisons, they are
                            > not making any kind of effort to reuse each other's code. I don't see how a
                            > project can suceed when there's such a massive communication problem.[/color]

                            In a small team it is reasonable to assume, even expect, detailed
                            knowledge of each others code. Namespaces would be a convenience, but
                            hardly essential. As teams grow the communication overhead reduces
                            their efficiency (I believe the optimum size is 4). Larger projects
                            are subdivided into teams. A team member has detailed knowledge of
                            the code in their project area, and less detailed knowledge of related
                            areas. No one has detailed knowledge of the whole project, so to
                            avoid name collisions you must have a system. Namespaces is one, a
                            naming convention is another.

                            --

                            __o Alex Farran
                            _`\<,_ Analyst / Programmer
                            (_)/ (_) www.alexfarran.com

                            Comment

                            • Chung Leong

                              #15
                              Re: Namespaces in PHP5, removed?

                              A large project doesn't imply one large application though. It's easy
                              enough--perhaps the wisest thing to do--to divide up a web application into
                              smaller ones, with the codebases that don't interact.

                              Uzytkownik "Alex Farran" <alex@alexfarra n.com> napisal w wiadomosci
                              news:m3r7x38c5e .fsf@alexfarran .com...[color=blue]
                              > Chung Leong writes:
                              >[color=green]
                              > > Clearly, if a team of developers continually have name collisons, they[/color][/color]
                              are[color=blue][color=green]
                              > > not making any kind of effort to reuse each other's code. I don't see[/color][/color]
                              how a[color=blue][color=green]
                              > > project can suceed when there's such a massive communication problem.[/color]
                              >
                              > In a small team it is reasonable to assume, even expect, detailed
                              > knowledge of each others code. Namespaces would be a convenience, but
                              > hardly essential. As teams grow the communication overhead reduces
                              > their efficiency (I believe the optimum size is 4). Larger projects
                              > are subdivided into teams. A team member has detailed knowledge of
                              > the code in their project area, and less detailed knowledge of related
                              > areas. No one has detailed knowledge of the whole project, so to
                              > avoid name collisions you must have a system. Namespaces is one, a
                              > naming convention is another.
                              >
                              > --
                              >
                              > __o Alex Farran
                              > _`\<,_ Analyst / Programmer
                              > (_)/ (_) www.alexfarran.com
                              >[/color]


                              Comment

                              Working...