Enhancements to PHP -- Polar

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Google Mike

    Enhancements to PHP -- Polar

    I like PHP a lot. It's my favorite programming language. That's not to
    say that I'd like to see it grow more or for derivatives to come from
    it. For me, the ideal programming language would be:

    * Would take the name of Polar instead of PHP.

    * Syntacticaly exactly like PHP, but would be much faster on string
    handling and would swap "." for "->".

    * Has all the same modules of PHP but would have extremely easy-to-use
    Qt and GTK modules (a way to build cross-platform GUIs), have fast ways
    to build ssh/telnet data entry or cash register apps for VT100 or VT220
    terminals, have faster ways to build HTML tables, have cookie routines
    that are encrypted (fast/slow, better modes), and has modules to allow
    admins to rapidly build admin interfaces to various database reference
    tables. The admin interface module, alone, would be a major time-saver.

    * Mostly a scripting language, but a fake compiler could be provided
    that would convert the script into a Linux ELF binary or EXE. However,
    when you run the binary, it extracts the script to $TEMP (or %TEMP%)
    (if not already extracted with same CRC stamp) and runs it in
    interpreted mode from there. You still need the interpreter to be
    installed before the binaries would work, which is forgivable. If you
    try to run the binary without the interpreter, it would display a
    friendly command-line message back suggesting that you "Google for the
    interpreter".

    * Various IDEs could be available for it, but it would have a slick,
    VB6-like IDE where you can build Qt or GTK "forms" with various widgets
    on them, doubleclick them to access their code, and then save as one
    big script, optimized as much as possible.

    * When run at command-line, it would NEVER spit out HTML on errors.
    When you run "php -q program.php", if your program has an error, you're
    going to get HTML back.

    * No need for "-q" for command-line programs like you need with PHP.

    * Would run indefinitely by DEFAULT, and not require "-d
    max_execution_t ime=10000" to be added. Instead, if you wanted a timeout
    restriction on the script, you'd have to add that into the script's
    source code at the top.

    * You can add new modules far easier without recompiling PHP and
    Apache.

    * Can be installed side-by-side other, earlier versions of Polar.

    * Can be installed even if you don't have Apache, providing a way to
    make GTK, Qt, or console-based apps.

    * Can be installed easily on Linux, or retrieved easily with "apt".

  • Michael Fesser

    #2
    Re: Enhancements to PHP -- Polar

    .oO(Google Mike)
    [color=blue]
    >I like PHP a lot. It's my favorite programming language. That's not to
    >say that I'd like to see it grow more or for derivatives to come from
    >it. For me, the ideal programming language would be:
    >
    >* Would take the name of Polar instead of PHP.[/color]

    Why Polar? Sounds somewhat ... cold. I don't like it.
    [color=blue]
    >* Syntacticaly exactly like PHP, but would be much faster on string
    >handling and would swap "." for "->".[/color]

    And what would you use for string concatenation if '.' is taken for
    property access/method calls? There's not much left.
    [color=blue]
    >* [...] have faster ways to build HTML tables, have cookie routines
    >that are encrypted (fast/slow, better modes), and has modules to allow
    >admins to rapidly build admin interfaces to various database reference
    >tables. The admin interface module, alone, would be a major time-saver.[/color]

    You're free to extend the PHP standard library.
    [color=blue]
    >* Mostly a scripting language, but a fake compiler could be provided
    >that would convert the script into a Linux ELF binary or EXE.[/color]

    Roadsend compiler exists.
    [color=blue]
    >However,
    >when you run the binary, it extracts the script to $TEMP (or %TEMP%)
    >(if not already extracted with same CRC stamp) and runs it in
    >interpreted mode from there. You still need the interpreter to be
    >installed before the binaries would work, which is forgivable.[/color]

    Zend Optimizer/Accelerator?
    [color=blue]
    >* Various IDEs could be available for it, but it would have a slick,
    >VB6-like IDE where you can build Qt or GTK "forms" with various widgets
    >on them,[/color]

    I prefer the Delphi IDE ... ;)
    [color=blue]
    >doubleclick them to access their code,[/color]

    .... and the Delphi Object Inspector ...
    [color=blue]
    >and then save as one
    >big script, optimized as much as possible.[/color]

    All code in one big file is really ugly.
    [color=blue]
    >* When run at command-line, it would NEVER spit out HTML on errors.
    >When you run "php -q program.php", if your program has an error, you're
    >going to get HTML back.[/color]


    [color=blue]
    >* No need for "-q" for command-line programs like you need with PHP.[/color]

    alias php='php -q'
    [color=blue]
    >* Would run indefinitely by DEFAULT, and not require "-d
    >max_execution_ time=10000" to be added. Instead, if you wanted a timeout
    >restriction on the script, you'd have to add that into the script's
    >source code at the top.[/color]

    The timeout makes sense on a shared host. If you run your own server you
    can disable it in the php.ini.
    [color=blue]
    >* You can add new modules far easier without recompiling PHP and
    >Apache.[/color]

    Can be done, but depends on the module. Recompiling is not always
    necessary.
    [color=blue]
    >* Can be installed side-by-side other, earlier versions of Polar.[/color]

    Possible with PHP (at least with the CGI version).
    [color=blue]
    >* Can be installed even if you don't have Apache, providing a way to
    >make GTK, Qt, or console-based apps.
    >
    >* Can be installed easily on Linux, or retrieved easily with "apt".[/color]

    Getting PHP with apt works, and even compiling a new version is easy:

    ../configure ...
    make
    make install

    That's it (it might require some additional library headers, which can
    be easily fetched with apt).

    Micha

    Comment

    • Michael Fesser

      #3
      Re: Enhancements to PHP -- Polar

      Forgot something ...

      .oO(Google Mike)
      [color=blue]
      >* Can be installed even if you don't have Apache, providing a way to
      >make GTK, Qt, or console-based apps.[/color]

      Possible with PHP (CLI).

      Micha

      Comment

      • Google Mike

        #4
        Re: Enhancements to PHP -- Polar

        ">>I like PHP a lot. It's my favorite programming language. That's not
        to[color=blue][color=green]
        >>say that I'd like to see it grow more or for derivatives to come from
        >>it. For me, the ideal programming language would be:[/color][/color]
        [color=blue][color=green]
        >>* Would take the name of Polar instead of PHP.[/color][/color]
        [color=blue]
        > Michael Fesser[/color]
        [color=blue]
        > Why Polar? Sounds somewhat ... cold. I don't like it."[/color]
        [color=blue]
        > etc....[/color]

        Michael F., I liked all of your constructive criticism. It also taught
        me a few things I didn't know.

        The name Polar was one of those things I spent time on during a few
        long boring flights across the USA before I discovered PHP. I was
        working for Avanade, and regretting that I did this, doing C#, and
        wondering what it would be like to work in a world without Microsoft,
        where things were free, where people shared some cool code snippets
        without charging, where the atmosphere among programmers was friendlier
        than the Microsoft environment I had to deal with. So I came up with a
        language specification and didn't know what to name it because all the
        other names are taken. I thought that Polar kind of had a math-ring to
        it so it stuck. Then, I discovered that PHP had grown up since I had
        last looked at it, and so my idea of the ideal business programming
        language for me moved from C# and Java into PHP.

        On the "." versus "->" issue, I think that string concatenation could
        be done with other characters. Of course, I've seen a thread like that
        before in the newsgroups. One says that "." should be "->" and then
        others chime in and say what about string concat., and then a reply
        comes back that string concat. could be done with "&", and then others
        complain about the fact that this is already used for something else,
        and on and on it goes. I don't want to go there. I just think that I'd
        rather use "." instead of "->" and still use string concat with ".".
        But then no one would be able to use my code but me, so that would be a
        drag. It's great to dream, though.

        Well, the dream bubble burst. I think I'll just stick with PHP. Didn't
        know about the alias command or the Roadsend thing. I'll have to try
        that.

        As for Delphi, I have to maintain some apps for that at my day job
        occasionally. It's frustrating for me with all the nested BEGIN/END
        statements that are easily mismatched. The IDE is confusing to me.
        Also, the fact that you can do nested functions inside functions is
        also an oddity.

        Comment

        • Chung Leong

          #5
          Re: Enhancements to PHP -- Polar

          "Google Mike" <googlemike@hot pop.com> wrote in message
          news:1111333225 .139792.223100@ o13g2000cwo.goo glegroups.com.. .[color=blue]
          > I like PHP a lot. It's my favorite programming language. That's not to
          > say that I'd like to see it grow more or for derivatives to come from
          > it. For me, the ideal programming language would be:
          >
          > * Would take the name of Polar instead of PHP.[/color]

          I don't like "PHP" either. Sounds like some sort of drug. Polar...hmmm. I
          kinda like it.
          [color=blue]
          > * Has all the same modules of PHP but would have extremely easy-to-use
          > Qt and GTK modules (a way to build cross-platform GUIs), have fast ways
          > to build ssh/telnet data entry or cash register apps for VT100 or VT220
          > terminals, have faster ways to build HTML tables, have cookie routines
          > that are encrypted (fast/slow, better modes), and has modules to allow
          > admins to rapidly build admin interfaces to various database reference
          > tables. The admin interface module, alone, would be a major time-saver.[/color]

          I disagree with that. The strength of PHP has always been its focus on
          server-side web development. Adding all these other components only creates
          distraction.
          [color=blue]
          > * You can add new modules far easier without recompiling PHP and
          > Apache.[/color]

          I can certainly agree with that. Writing a PHP module actually isn't that
          hard. Getting PHP to compile, on Windows especially, is a pain in the ass.

          Maybe adopting some sort of a component module like XPCOM would make things
          easier.
          [color=blue]
          > * Can be installed side-by-side other, earlier versions of Polar.[/color]

          Really trivial to implement. Exactly why it wasn't I have no idea.


          Comment

          • Michael Fesser

            #6
            Re: Enhancements to PHP -- Polar

            .oO(Google Mike)
            [color=blue]
            >Didn't
            >know about the alias command[/color]

            It's quite convenient from time to time to setup "shortcut" commands.
            [color=blue]
            >or the Roadsend thing.[/color]

            It's a commercial PHP compiler, has nothing to do with Zend etc. It just
            uses the grammar of PHP and compiles to native executables or libraries.


            [color=blue]
            >As for Delphi, I have to maintain some apps for that at my day job
            >occasionally . It's frustrating for me with all the nested BEGIN/END
            >statements that are easily mismatched.[/color]

            The same may happen with {}, it's the same. The developer is responsible
            for writing clean code.
            [color=blue]
            >The IDE is confusing to me.
            >Also, the fact that you can do nested functions inside functions is
            >also an oddity.[/color]

            There's nothing special about them, it's just a scope issue. In other
            languages (Java IIRC) you can nest classes inside classes etc. And there
            are even people asking if PHP supports nested functions. ;)

            Micha

            Comment

            • Chung Leong

              #7
              Re: Enhancements to PHP -- Polar

              "Google Mike" <googlemike@hot pop.com> wrote in message
              news:1111341837 .963088.13730@l 41g2000cwc.goog legroups.com...[color=blue]
              > As for Delphi, I have to maintain some apps for that at my day job
              > occasionally. It's frustrating for me with all the nested BEGIN/END
              > statements that are easily mismatched. The IDE is confusing to me.
              > Also, the fact that you can do nested functions inside functions is
              > also an oddity.[/color]

              The use of begin/end is actually one thing I like about Delphi. By and
              large, the community only uses one convention (begin and end on separate
              lines). The curly brackets, on the other hand, are done in number of
              different ways. I always get confused reading code where "else" follows the
              preceding } without a linebreak. One of the reasons I hate PEAR...


              Comment

              • Michael Fesser

                #8
                Re: Enhancements to PHP -- Polar

                .oO(Chung Leong)
                [color=blue]
                >The curly brackets, on the other hand, are done in number of
                >different ways.[/color]

                There are only two, which are commonly used.
                [color=blue]
                >I always get confused reading code where "else" follows the
                >preceding } without a linebreak.[/color]

                I prefer that. ;)

                Micha

                Comment

                • Berislav Lopac

                  #9
                  Re: Enhancements to PHP -- Polar

                  Google Mike wrote:[color=blue]
                  > On the "." versus "->" issue, I think that string concatenation could
                  > be done with other characters. Of course, I've seen a thread like that
                  > before in the newsgroups. One says that "." should be "->" and then
                  > others chime in and say what about string concat., and then a reply
                  > comes back that string concat. could be done with "&", and then others
                  > complain about the fact that this is already used for something else,
                  > and on and on it goes. I don't want to go there. I just think that I'd
                  > rather use "." instead of "->" and still use string concat with ".".
                  > But then no one would be able to use my code but me, so that would be
                  > a drag. It's great to dream, though.[/color]

                  I was thinking that no concatenation operator is really necessary. Imagine
                  that an ebsence of any operator meant concatenation, e.g.

                  $concatenatedSt ring = $myVar ' here goes some text'
                  $then_some_othe r_variable "and then some $embeddedVar."

                  Berislav


                  Comment

                  • Berislav Lopac

                    #10
                    Re: Enhancements to PHP -- Polar

                    Google Mike wrote:[color=blue]
                    > I like PHP a lot. It's my favorite programming language. That's not to
                    > say that I'd like to see it grow more or for derivatives to come from
                    > it. For me, the ideal programming language would be:[/color]

                    <snip>

                    Have you tried Python?

                    Berislav


                    Comment

                    • Kristian Köhntopp

                      #11
                      Re: Enhancements to PHP -- Polar

                      Chung Leong wrote:[color=blue]
                      > "Google Mike" <googlemike@hot pop.com> wrote in message[color=green]
                      >> * Would take the name of Polar instead of PHP.[/color]
                      > I don't like "PHP" either. Sounds like some sort of drug.[/color]

                      That's a very old jokel




                      That being said, there is the CLI (not CGI) version of PHP. Any number of
                      these can be installed.

                      kris@h3118:~> php -v
                      PHP 4.3.10 (cli) (built: Feb 28 2005 13:10:32)
                      Copyright (c) 1997-2004 The PHP Group
                      Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies
                      kris@h3118:~> php5 -v
                      PHP 5.1.0-dev (cli) (built: Feb 23 2005 10:59:22)
                      Copyright (c) 1997-2004 The PHP Group
                      Zend Engine v2.1.0-dev, Copyright (c) 1998-2004 Zend Technologies

                      While CLI still does require <?php ?>-Syntax, it does not echo a CGI header
                      when being called

                      cookiekris@h311 8:~> php5
                      <?php echo "cookie\n"; ?>
                      cookie

                      Also, error messages are no longer HTMLized in CLI:

                      kris@h3118:~> php5
                      <?php cookie

                      Parse error: syntax error, unexpected $end in - on line 2

                      Kristian

                      Comment

                      • Eric

                        #12
                        Re: Enhancements to PHP -- Polar

                        Berislav Lopac <berislav.lopac @lopsica.com> wrote:[color=blue]
                        > Have you tried Python?[/color]

                        Ya - tastes like chicken.

                        Comment

                        • Google Mike

                          #13
                          Re: Enhancements to PHP -- Polar

                          Thanks, Kristian.

                          Ah, so PHP5 doesn't emit HTML at CLI when an error occurs, but PHP 4
                          does. I'll keep that in mind when I'm ready to upgrade.

                          Comment

                          • Brion Vibber

                            #14
                            Re: Enhancements to PHP -- Polar

                            Google Mike wrote:[color=blue]
                            > Ah, so PHP5 doesn't emit HTML at CLI when an error occurs, but PHP 4
                            > does. I'll keep that in mind when I'm ready to upgrade.[/color]

                            $ php --version
                            PHP 4.3.10 (cli) (built: Jan 23 2005 21:23:17)
                            Copyright (c) 1997-2004 The PHP Group
                            Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies
                            $ php
                            <?php fatal_error_tim e(); ?>
                            ^D
                            Fatal error: Call to undefined function: fatal_error_tim e() in
                            /Users/brion/- on line 1


                            Doesn't look like HTML to me.

                            -- brion vibber (brion @ pobox.com)

                            Comment

                            • Google Mike

                              #15
                              Re: Enhancements to PHP -- Polar

                              Berislav,

                              Yeah, I couldn't get PHP GTK to install, so I looked at how Red Hat
                              does their control panels. I found out that they do them in GTK and
                              Python. So I then made the 'pgst' tool with that. I'm not a fan of
                              Python, nor a good programmer in it, but at least I got it to work.

                              You can download this tool via apt or get it from here:

                              Download pgst for free. An intuitive GUI (GTK-based) for PostgreSQL management in under 100K (zipped).


                              It permits one to have a GUI for interfacing with PostgreSQL. We use it
                              all the time in my day job because we prefer to do PHP/PostgreSQL apps
                              over PHP/MySQL. We're a fan of LAPP here, not LAMP.

                              Comment

                              Working...