A PHP fork

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Chung Leong

    #1

    A PHP fork

    For the past few months I've been working on a fork of PHP from the
    version 4 source code. I call the new dialect "Polar." It's different
    from PHP 5 in that it's a procedural-centric language. One of the key
    additions is function overloading, which lets you do polymorphism
    procedurally:

    function db_query($sql, $db:MySQLDB) {
    /* MySQL-specific code here */
    }

    function db_query($sql, $db:PostgresDB) {
    /* Postgres-specific code here */
    }

    Aside from that there are many other enhancements like a float-based
    datetime type and a Unicode string type. It's pretty neat. You can find
    more information at http://www.polarwiki.net/. The site is hosted on
    the Polar itself, though it's running mostly PHP apps. I have built a
    standalone Windows program that demonstrate the new features. You can
    download it at the the web site.

    Right now I'm just an army of one. I'm definitely looking for more
    help. Drop a note in the message forum if you interested. Any comments
    are welcomed too.

  • Richard Levasseur

    #2
    Re: A PHP fork

    Function overloading is a feature a lot of people want. Why not merge
    this with the existing PHP code? I'm sure they would love to have
    someone with your talent contributing!


    Chung Leong wrote:
    For the past few months I've been working on a fork of PHP from the
    version 4 source code. I call the new dialect "Polar." It's different
    from PHP 5 in that it's a procedural-centric language. One of the key
    additions is function overloading, which lets you do polymorphism
    procedurally:
    >
    function db_query($sql, $db:MySQLDB) {
    /* MySQL-specific code here */
    }
    >
    function db_query($sql, $db:PostgresDB) {
    /* Postgres-specific code here */
    }
    >
    Aside from that there are many other enhancements like a float-based
    datetime type and a Unicode string type. It's pretty neat. You can find
    more information at http://www.polarwiki.net/. The site is hosted on
    the Polar itself, though it's running mostly PHP apps. I have built a
    standalone Windows program that demonstrate the new features. You can
    download it at the the web site.
    >
    Right now I'm just an army of one. I'm definitely looking for more
    help. Drop a note in the message forum if you interested. Any comments
    are welcomed too.

    Comment

    • Fraser Tweedale

      #3
      Re: A PHP fork

      Wow! Nice work man!

      I'm a big fan of OO myself, but as already mentioned there are a lot of
      people out there wanting more from PHP in the procedural programming
      department.

      Good on you for taking the initiative to do this.

      t

      Chung Leong wrote:
      For the past few months I've been working on a fork of PHP from the
      version 4 source code. I call the new dialect "Polar." It's different
      from PHP 5 in that it's a procedural-centric language. One of the key
      additions is function overloading, which lets you do polymorphism
      procedurally:
      >
      function db_query($sql, $db:MySQLDB) {
      /* MySQL-specific code here */
      }
      >
      function db_query($sql, $db:PostgresDB) {
      /* Postgres-specific code here */
      }
      >
      Aside from that there are many other enhancements like a float-based
      datetime type and a Unicode string type. It's pretty neat. You can find
      more information at http://www.polarwiki.net/. The site is hosted on
      the Polar itself, though it's running mostly PHP apps. I have built a
      standalone Windows program that demonstrate the new features. You can
      download it at the the web site.
      >
      Right now I'm just an army of one. I'm definitely looking for more
      help. Drop a note in the message forum if you interested. Any comments
      are welcomed too.
      >

      Comment

      • Chung Leong

        #4
        Re: A PHP fork

        Richard Levasseur wrote:
        Function overloading is a feature a lot of people want. Why not merge
        this with the existing PHP code? I'm sure they would love to have
        someone with your talent contributing!
        Function overloading in Polar only works for standalone functions, not
        class methods. As the intention here is to move away from OOP, that's
        fine. I doubt that that's a limitation people would accept, since OOP
        is the direction that PHP is heading.

        Overloading in a dynamically typed language is rather different from
        overloading in a strongly typed language like C++. In the latter,
        resolution of function calls happens at compile time. In the former, it
        has to happn at runtime. Overloading here is a form of dynamic
        dispatch, akin to calling virtual methods on an object. Having two
        dynamic dispatch mechanisms working in unison is probably too
        confusing.

        Comment

        • R. Rajesh Jeba Anbiah

          #5
          |OT| Polar, a PHP fork by Chung Leong (Was Re: A PHP fork)

          Chung Leong wrote:
          For the past few months I've been working on a fork of PHP from the
          version 4 source code. I call the new dialect "Polar."
          <snip>

          Kudos. When everyone is digging on frameworks and Ajax, you did
          fork PHP! I suppose, you have enough free time;-) Changes look cool
          <http://www.polarwiki.n et/index.pola/Changes_in_Pola r All the best.

          --
          <?php echo 'Just another PHP saint'; ?>
          Email: rrjanbiah-at-Y!com Blog: http://rajeshanbiah.blogspot.com/

          Comment

          • Mladen Gogala

            #6
            Re: A PHP fork

            On Thu, 06 Jul 2006 13:48:23 -0700, Chung Leong wrote:
            For the past few months I've been working on a fork of PHP from the
            version 4 source code. I call the new dialect "Polar." It's different
            from PHP 5 in that it's a procedural-centric language. One of the key
            additions is function overloading, which lets you do polymorphism
            procedurally:
            >
            function db_query($sql, $db:MySQLDB) {
            /* MySQL-specific code here */
            }
            >
            function db_query($sql, $db:PostgresDB) {
            /* Postgres-specific code here */
            }
            >
            Aside from that there are many other enhancements like a float-based
            datetime type and a Unicode string type. It's pretty neat. You can find
            more information at http://www.polarwiki.net/. The site is hosted on
            the Polar itself, though it's running mostly PHP apps. I have built a
            standalone Windows program that demonstrate the new features. You can
            download it at the the web site.
            >
            Right now I'm just an army of one. I'm definitely looking for more
            help. Drop a note in the message forum if you interested. Any comments
            are welcomed too.
            Chung, you're one of my favorite PHP masters and I learned few things from
            you on this group, but the work you're doing has already been done. PHP
            runkit extension, by Sara Golemon, has this possibility:

            RUNKIT_IMPORT_O VERRIDE (integer)

            runkit_import() flag indicating that if any of the imported functions,
            methods, constants, or properties already exist, they should be
            replaced with the new definitions. If this flag is not set, then any
            imported definitions which already exist will be discarded.

            This sounds very much like overloading to me.


            --
            大红鹰娱乐平台采用顶级加密技术,确保用户数据与交易的安全无虞,让玩家能够放心畅玩。


            Comment

            • Andy Hassall

              #7
              Re: A PHP fork

              On Fri, 07 Jul 2006 18:49:07 GMT, Mladen Gogala <gogala@sbcglob al.netwrote:
              >Chung, you're one of my favorite PHP masters and I learned few things from
              >you on this group, but the work you're doing has already been done. PHP
              >runkit extension, by Sara Golemon, has this possibility:
              >
              >RUNKIT_IMPORT_ OVERRIDE (integer)
              >
              runkit_import() flag indicating that if any of the imported functions,
              methods, constants, or properties already exist, they should be
              replaced with the new definitions. If this flag is not set, then any
              imported definitions which already exist will be discarded.
              >
              >This sounds very much like overloading to me.
              That's just redefinition, not overloading...

              --
              Andy Hassall :: andy@andyh.co.u k :: http://www.andyh.co.uk
              http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool

              Comment

              • Chung Leong

                #8
                Re: A PHP fork

                Mladen Gogala wrote:
                Chung, you're one of my favorite PHP masters and I learned few things from
                you on this group, but the work you're doing has already been done. PHP
                runkit extension, by Sara Golemon, has this possibility:
                >
                RUNKIT_IMPORT_O VERRIDE (integer)
                >
                runkit_import() flag indicating that if any of the imported functions,
                methods, constants, or properties already exist, they should be
                replaced with the new definitions. If this flag is not set, then any
                imported definitions which already exist will be discarded.
                >
                This sounds very much like overloading to me.
                No, actually it's not even close. The runkit just exposes
                functionalities in the Zend engine. Overwriting a function is not the
                same as overloading it. Wikipedia has a good explanation
                http://en.wikipedia.org/wiki/Function_overloading.

                What Polar supports is a type of dynamic dispatch, controlled by the
                types of the arguments. I call it Sematic Polymorphism. It's similiar
                to polymorphism in OOP, except functions are bound to meanings not
                objects.

                Say we have the following functions:

                <?

                function SaveObjectToDat abase($object:O bject, $db:MysqlDB) {
                }

                function SaveObjectToDat abase($article: Article, $db:MysqlDB) {
                }

                ?>

                Both functions are bound to the meaning of "saving an object to a MySQL
                database." The second function is bound to a more specific meaning,
                that of "saving an object of the class Article to a MySQL database." In
                OOP terms we would say that the second meaning is a descendant of the
                first. The relationship isn't stated explicitly, but it's understood.

                It's neat idea. There're also a host of other features which I think
                are pretty interesting. Pragmas for example. Or Flex case identifiers.


                If you have time, take a look at the demo program. You can download it
                here:
                http://sourceforge.net/project/showf...roup_id=171247

                Comment

                Working...