Live data from Hacker News

Announcing a specification for PHP

hhvm.com

51–60 of 263 posts

Re: Announcing a specification for PHP

#51
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.

Well, sometimes it's good to be able to tell whether some code is of the language in question or not. That's were a spec comes in handy, whether it's considered ongoing or not.

Re: Announcing a specification for PHP

#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.

Re: Announcing a specification for PHP

#53
post #7
post #4

As a discussion of any programming language grows longer, the probability of a bashing against such language approaches 1. Any similarity with Godwin's law is mere coincidence.

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

There are languages whose communities everybody hates, but it doesn't seem to be that everybody hates Ruby or Clojure or whatever. Just that everybody hates their trendiness.

Re: Announcing a specification for PHP

#54
post #7
post #4

As a discussion of any programming language grows longer, the probability of a bashing against such language approaches 1. Any similarity with Godwin's law is mere coincidence.

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.

Re: Announcing a specification for PHP

#55
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…

For me this is the important part.

I have a team with java/php/javascript experience. PHP will not be an option for my use case. I need a json based rest interface with a decently discoverable web interface. Java has stupidly powerful rest interface libraries with jersey or full application servers, and javascript has hugely powerful frontend interfaces with angular or other frameworks, based on a strong rest interface. And the strong rest interface goes right back at java.

And we are just a limited team with java* experience. I don't know what teams with django or other twisted libraries will do, or what ruby shops will do. The era of "just make it easy to print html" is gone.

Re: Announcing a specification for PHP

#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/php-spec/

Re: Announcing a specification for PHP

#57
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…

Nikita proposes methods on primitive types: http://nikic.github.io/2014/03/14/Methods-on-primitive-types... Myself, I like this proposal.

Soon all dynamic languages will be one. Except for the method call syntax.

Re: Announcing a specification for PHP

#58
I'm not really a fan of having a second source of truth compared to in depth material already on php.net. The two will invariably start to disagree and php.net is much, much better than any spec or documentation I have ever read. Using Android is a nightmare compared to php.net because every single thing on php.net has extensive user generated documentation whereas Android is just some broken official docs. I submitted a bug report with a fix for the Android docs telling people to make dialogs in a way that simply crashed and didn't work and it was never merged in for years and years. So official specs tend to suck.

Re: Announcing a specification for PHP

#59
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.

Fair enough... it's not hated universally, but it is hated passionately by some.

Re: Announcing a specification for PHP

#60
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.

There are many other options, none of which enjoy the ubiquity of PHP (as far as being installed on such a vast majority of hosts).

The barrier to entry is higher if you want to run a site on something else.

That is the sole reason PHP is as popular as it is and part of the reason why it stays popular and powers so many of the internet's top websites.

Other reasons why it stays popular is that they really have improved it a lot over the years and knowledge on how to run PHP at scale is quite easily available. The community is improving along with the language.

Yes, the standard library is frustrating but that is a pretty minor inconvenience honestly. Every language has a frustrating part of its design. This wart on PHP can be fixed and there are some great recommendations on how to transition to a better std lib in other comments on this OP.

Post reply on HN