Live data from Hacker News

Announcing a specification for PHP

hhvm.com

71–80 of 263 posts

Re: Announcing a specification for PHP

#71
post #34

This is great news for the PHP community, and I for one applaud their effort. Contrary to what many HN hipsters seems to believe, PHP is quite a capable language, and HHVM / Hack is really pushing things forward. * Hack introduces type hinting, imo the major lacking part in PHP. * HHVM introduces speed to php. On a personal project calculating perlin noise, I got about 8x speedup on HHVM. * The specification helps pa…

> Contrary to what many HN hipsters seems to believe, PHP is quite a capable language, and HHVM / Hack is really pushing things forward. This attitude really frustrates me. I'm a developer with over 20 years of experience. I don't use PHP because (a) I have had poor experiences with it in the past, (b) I am enjoying my current stack (Java8/Clojure/Groovy), and (c) would go with stacks like RoR over PHP if I had to ch…

Sorry if i offended you. I really did not try to imply this has to do with trendiness, but it was a frustrated outbreak from my end. I've seen way too many poisonous hater comments against everything PHP here since I started visiting.

I myself use (besides PHP) C#, Javascript, Python, and recently revisited C++ to check out C++11 (I am thrilled). I have been working developing in mainly PHP since 1999 so I have seen most of it's ugly sides.

This thread however was about PHP, not wether Java is good or bad.

Re: Announcing a specification for PHP

#72
post #42

This is great news for the PHP community, and I for one applaud their effort. Contrary to what many HN hipsters seems to believe, PHP is quite a capable language, and HHVM / Hack is really pushing things forward. * Hack introduces type hinting, imo the major lacking part in PHP. * HHVM introduces speed to php. On a personal project calculating perlin noise, I got about 8x speedup on HHVM. * The specification helps pa…

> PHP is quite a capable language I don't think anyone is complaining that it's not turing complete (or whatever), it's all the times php has dropped the ball in the std library, both with respect to being consistent with itself and just being plain broken. I don't think any sane person would switch from a language INTO php, given how many languages that are just as capable as php without having all of its various hi…

Have there been any implementation decisions that have forced PHP to take a step backwards?

There are many things that they language has had to fix, and some that still need to fix. But I honestly don't feel that the direction in which the language is headed is encumbering the language further.

Re: Announcing a specification for PHP

#73
post #34

This is great news for the PHP community, and I for one applaud their effort. Contrary to what many HN hipsters seems to believe, PHP is quite a capable language, and HHVM / Hack is really pushing things forward. * Hack introduces type hinting, imo the major lacking part in PHP. * HHVM introduces speed to php. On a personal project calculating perlin noise, I got about 8x speedup on HHVM. * The specification helps pa…

> Contrary to what many HN hipsters seems to believe, PHP is quite a capable language, and HHVM / Hack is really pushing things forward. This attitude really frustrates me. I'm a developer with over 20 years of experience. I don't use PHP because (a) I have had poor experiences with it in the past, (b) I am enjoying my current stack (Java8/Clojure/Groovy), and (c) would go with stacks like RoR over PHP if I had to ch…

> I am enjoying my current stack (Java8/Clojure/Groovy)

Not just trendiness, but also whether a spec exists, from which alternative implementations can be reliably built. Some language despots (e.g. Python's) have even had moritorium periods of no new features specifically to help other implementations catch up. The spec announcement is a step forward for PHP.

Your current stack is at widely varying extremes along the spec continuum:

* Java 8 is fully spec'd to intricate detail, and Java has implementations other than Oracle's. Anyone can build an implementation as long as they don't call it Java.

* Clojure is informally spec'd by the comments in the functions, and what little grammar there is is explained on the clojure.org website. Alternative implementations exist to varying degrees of compatibility, e.g. ClojureScript doesn't have native macros.

* Groovy has virtually no spec at all after 11 yrs. Despite it being spec-driven at first, its JSR was inactive for 7 yrs, then changed to dormant status 3 yrs ago. My personal experience is the Codehaus project management actively prevent other implementations being built.

Re: Announcing a specification for PHP

#74
post #42

Earlier quoted context omitted.

> PHP is quite a capable language I don't think anyone is complaining that it's not turing complete (or whatever), it's all the times php has dropped the ball in the std library, both with respect to being consistent with itself and just being plain broken. I don't think any sane person would switch from a language INTO php, given how many languages that are just as capable as php without having all of its various hi…

Amen. I think this thread could use a little: http://eev.ee/blog/2012/04/09/php-a-fractal-of-bad-design/ It has never been about whether PHP can get shit done, it's that given languages that actually had formal design processes and make your days as a coder a joy, why would you move TO PHP. There are simply so many other options.

The PHP Bad Fractal Design article is The Godwin's Law of PHP programming discussions.

Re: Announcing a specification for PHP

#75
post #52
post #14

The PHP grammar in BNF starts at line 10354. It not that extensive as some may think and rather similar to what Java BNF looks like. The expression statement is a bit more extensive than in most languages, as PHP also supports the little known template-style (if elseif endif;): http://php.net/manual/en/control-structures.alternative-synt... Thanks for the PHP spec. Btw. GitHub says "Sorry, this blob took too long to…

Hack has actually dropped support for that format, the only place I've ever seen it used seriously is in wordpress.

The alt syntax is pretty heavily used in frameworks that use vanilla PHP for their view templating, including the Zend Framework..

Re: Announcing a specification for PHP

#76
post #17

This is great news for the PHP community, and I for one applaud their effort. Contrary to what many HN hipsters seems to believe, PHP is quite a capable language, and HHVM / Hack is really pushing things forward. * Hack introduces type hinting, imo the major lacking part in PHP. * HHVM introduces speed to php. On a personal project calculating perlin noise, I got about 8x speedup on HHVM. * The specification helps pa…

I don't think many would claim that PHP isn't capable. It's that some of us just don't enjoy it and find it to ugly. Especially given how mature competing languages have become.

All due respect it is easy to write shitty code in PHP but you can also craft elegant design patterns that are easy to grok.

I can't think of a language that has out of box adoption for web development similar to PHP.

Re: Announcing a specification for PHP

#77
post #7

Earlier quoted context omitted.

There are languages that everybody hates, and then there are the languages nobody uses.

I believe C++ is not hated universally and is still used like everywhere.

To better word the original saying: "There are languages that the minority of geeks that like to quarel about languages hates, and there are languages that nobody uses -- but for both cases, the millions of programmers out there could not care less".

Re: Announcing a specification for PHP

#78
post #31
post #6

Earlier quoted context omitted.

That's not uncommon for implementation-defined languages. Ruby didn't have a language specification until the community set up rubyspec as it started getting serious about alternative implementations. Facebook is apparently getting serious about its own alternative implementation (or at least intending to be taken seriously) and are thus stepping in with a spec.

Often I wonder if going without Spec is a good thing. Ruby doesn't want a Spec because Matz said Ruby is an always evolving languages. But the same could be said about HTML 5 where it does have a living spec.

> Ruby doesn't want a Spec

Both RubySpec and the ISO standardization effort suggest that this is less than true.

> because Matz said Ruby is an always evolving languages.

That's not a reason not to have a spec; that's a reason that the current bleeding-edge version might diverge intentionally from the spec and that the spec might trail.

(Or, as in the case of HTML/HTML5, its why you might have both an evolving target spec, like WHATWG has with the HTML living spec, for language implementers to develop toward, and a more conservative one, like the W3C HTML5 spec, that is more geared toward what language users should target.)

Without a spec -- preferably one that is or includes an executable test suite -- independent implementations are problematic, and multiple independent implementations that can experiment with different innovations is good for an "always evolving language".

Re: Announcing a specification for PHP

#79
post #23

After recently having to work with modern PHP, I have to say a lot of the criticism of the language is unfounded. It's changed a lot since I first used it. But the stdlib is still hard to manage. Different naming conventions, different order on the parameters for functions that do almost the same thing, and every function is global. Couldn't they keep all that for backwards compatibility, but create more sane wrapper…

Fun with PHP:

    $a = 'b';
    $b = 'a';
    echo $a."\n";
    >>> b
    echo $$a."\n";
    >>> a
    echo $$$a."\n";
    >>> b
Yaaa

    $obj = new StdClass();
    $obj->x = 1;

    function x_plus_one($obj) {
        $obj->x++;
    }

    x_plus_one($obj);
    var_dump($obj);
    >>> object(stdClass)#1 (1) {
    >>>  ["x"]=>
    >>>  int(2)
    >>> }
Huh? A local change to the object changed the object outside the local scope? It must have been passed by reference...

    function null_the_object($obj) {
        $obj = null;
    }

    null_the_object($obj);
    var_dump($obj);
    >>> object(stdClass)#1 (1) {
    >>>  ["x"]=>
    >>>  int(2)
    >>> }
Huh? Before when I edited the object within the function, the object I passed in was edited, what gives?

We don't actually pass objects to reference in PHP, we pass them by "object reference." But don't worry, you can still null objects that get passed to you:

    function null_the_object_2(&$obj) {
        $obj = null;
    }

    null_the_object_2($obj);
    var_dump($obj);
    >>> NULL
Sure it's not as bad as it used to be. Yes, a disciplined developer can make good software with it, but it's still a pretty quirky.

Re: Announcing a specification for PHP

#80
post #56

Maybe I'm missing something here...but the OP links to what must be a gigantic Markdown file that Github will not serve up...Is the spec meant to be in a giant doc, or will it be split up into smaller sections? This seems like a perfect use for Jekyll if they're going to publish on Github... In any case, I did a quick-fork and generated a Github page from the Markdown file linked to by OP: http://dannguyen.github.io/…

Nice. Thanks.

In my mind, there will be multiple renderings of the spec (like what you had done here). I have plans to split the spec into multiple, smaller .md files based on topic. The gating factor was managing the internal reference links, but I can work around that with some tooling. I did not want this to hold up getting the spec out there though.

Post reply on HN