Catch up on stories from the past week (and beyond) at the Slashdot story archive

 



Forgot your password?
typodupeerror
×
PHP Programming

PHP Finally Getting a Formal Specification 180

itwbennett (1594911) writes "Despite becoming one of the most widely used programming languages on the Web, PHP didn't have a formal specification — until now. Facebook engineer and PHP core contributor Sara Golemon announced the initiative at OSCON earlier this month, and an initial draft of the specification was posted Wednesday on GitHub."
This discussion has been archived. No new comments can be posted.

PHP Finally Getting a Formal Specification

Comments Filter:
  • Comment removed (Score:4, Insightful)

    by account_deleted ( 4530225 ) on Thursday July 31, 2014 @01:29PM (#47575953)
    Comment removed based on user account deletion
    • by OzPeter ( 195038 ) on Thursday July 31, 2014 @01:57PM (#47576189)

      Python has emerged a juggernaut to contend with in RESTful coding environments.

      Putting aside the whole whitespace debate(*), I'm pretty sure that python has its own list of issues. Maybe not to the same extent as PHP, but they exist.

      * For which I personally do have trouble with python - I want the computer to bend to my will, not the other way around.

      • Putting aside the whole whitespace debate(*), I'm pretty sure that python has its own list of issues. Maybe not to the same extent as PHP, but they exist.

        Picking a programming language is like picking an application, though. It's not about picking the syntax. That's not particularly relevant unless you're looking at Brainfuck or INTERCAL or GW-BASIC. You start by deciding what capabilities you need. There are inevitably several choices that meet your technical requirements, so in the end you're picking a language based on whatever set of limitations and issues you're willing to work with.

        • Then I did it 30 years wrong.
          Picking languages by syntax, shame on me.
          Perhaps I should now try a Lisp like language finally?

          Wtf, what nonsense ... what language has a capability another language has not? Wow, now we are at language paradigms, functional, oo etc.

          A language should either be a DSL or oo or at least functional, if it is neither, it is close to useless (yes, that includes C) and I certainly won't use a language that hurt my eyes and where I have in simple situations to think about 'syntax'.

      • by rdnetto ( 955205 )

        Putting aside the whole whitespace debate(*), I'm pretty sure that python has its own list of issues.

        My understanding is that Python's two biggest issues are a lack of static typing (justifiable, but annoying) and the ability to use arbitrary objects as dictionaries. The latter causes significant issues when trying to optimize code, because something as simple as reading a value from a property becomes a hashtable lookup.

        • Most high level scripting languages (can't speak for PHP, but it's true for Perl, Ruby and Python) implement simple user defined objects as dictionaries. That said, the lookup cost, while obviously much higher than pre-compiled v-tables, are not as expensive as you might imagine; attribute access uses interned strings, and strings cache their hash code on first hash. If you don't actually have to recompute the hash, and equality checks are (for attribute lookup) a simple reference identity test, the CPU cos

          • Nice to know how that works, but ordinary languages like C++ and Java etc. don't need a v-table to access attributes.
            The offset into the 'record' is calculated by the compiler, so accessing it is just 'base pointer' + 'offset'. Like in Pascal and any other language supporting something like a 'record'.

          • Comment removed based on user account deletion
        • Want static typing? Use Cython.
        • by jambox ( 1015589 )
          Those aren't issues, they're features. Lack of static typing (odd choice of words - you could say Java lacks dynamic typing) allows much sparser code and you don't have to waste time compiling. The downside is there's more chance of runtime errors, but the time you've saved probably makes up for it and hell, you've got time now to write those unit tests. Performance isn't Python's strong point, but there are lots of options. For example, if you want to parse XML, ElementTree has a fantastic API and is writ
      • Comment removed based on user account deletion
      • by narcc ( 412956 )

        I'm pretty sure that python has its own list of issues. Maybe not to the same extent as PHP, but they exist.

        Python's problems are far broader and deeper than PHP's. At least with PHP, there isn't anything fundamentally wrong with the language. Python, on the other hand, is beyond salvation.

        Just one example: The whitespace issue isn't simply a matter of personal preference. It's why Python will NEVER have anonymous functions without laughably absurd limitations.

      • by tlhIngan ( 30335 )

        * For which I personally do have trouble with python - I want the computer to bend to my will, not the other way around.

        A good syntax highlighter would easily point out where you mixed tabs and spaces together by highlighting the offending error in red.

        And Python's pretty flexible, actually - if you use a tab to indent, then use spaces, that's allowable, as long as you always use tab then spaces on that block. Tab-tab is an error, as is spaces-tab.

        The other advantage is it kills of the debate of where the b

      • Putting aside the whole whitespace debate(*)...

        * For which I personally do have trouble with python - I want the computer to bend to my will, not the other way around.

        Do you only use languages that let you choose the language keywords? Surely there is leeway in how much bending to your will that you demand of a language.

        If you indent your C, PHP, Java, or whatever else sanely, then you will have no issues with Python indentation rules. They are just the sane C rules, but enforced.

  • by geminidomino ( 614729 ) on Thursday July 31, 2014 @01:40PM (#47576029) Journal

    I wonder if my favorite bug/misfeature will make the cut and be enshrined forever, because it's *fun* when a successful database instruction throws an exception.

  • by NoNonAlphaCharsHere ( 2201864 ) on Thursday July 31, 2014 @01:42PM (#47576037)
    Unfortunately, it's written in PHP, so there's some disagreement about WHAT is says.
  • by goodmanj ( 234846 ) on Thursday July 31, 2014 @02:56PM (#47576737)

    PHP Formal Specification:

    1) Don't use PHP.

    • by lgw ( 121541 ) on Thursday July 31, 2014 @07:25PM (#47578545) Journal

      PHP Formal Specification:

      1) Don't use PHP.

      No wonder you're getting modded down if you think that's a formal specification! C'mon:


      1. Abstract.

      Don't use PHP.

      2. Conventions used in this document.

      The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
      "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
      document are to be interpreted as described in RFC-2119

      3. Normative Guidance for the Use of PHP

      One MUST NOT use PHP.

  • I formally specify PHP to be crap!

Some people manage by the book, even though they don't know who wrote the book or even what book.

Working...