Live data from Hacker News

Announcing a specification for PHP

hhvm.com

31–40 of 263 posts

Re: Announcing a specification for PHP

#31
post #6
post #2

A language without a spec ? Damn, php is even worse than I thought. Still, FB may turn it (with hack and HMMV) into something interesting.

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.

Re: Announcing a specification for PHP

#33
I sure hope Sara Golemon gets the recognition out of this that she deserves (and which the article starts to build.) Having met her at a couple conferences, she continues to demonstrate a brilliant understanding of what it takes to build a programming language WHILE being a tremendous advocate and builder of a community where being a member isn't always... popular.

Rock on, @saramg

Re: Announcing a specification for PHP

#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 choose, simply because I've had good experiences with Rails.

You're implication that this has something to do with trendiness is frankly insulting.

Re: Announcing a specification for PHP

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

If you want to order your program in a specific way, you introduce the appropriate level of abstraction. Same as with any other language.

EDIT: i totally agree that the standard functions are a complete mess in PHP. But they have to stay around for backwards compatibility. Have a look at the SPL classes: http://php.net/manual/en/book.spl-types.php

Re: Announcing a specification for PHP

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

I got the same message on GitHub. Did you checkout the repo in order to read it? Personally, this is exciting news, but I'm not sure that PHP is ready for this after 20 years. There's plenty of cleanup that needs to be done to userland naming conventions and parameter orders that in all likelihood won't get done anytime soon to avoid breaking BC

yes, you can also use the "Download Zip" button there: https://github.com/php/php-spec

PHP ships with a lot of third party C libraries that are exposed in PHP with usually their original function names. Object orientation came with PHP 4 and later with PHP 5 the new better one (5.3+ with namespace support, traits, etc.).

You can think of PHP as a mixture of C, C++ and Java for web development and CLI tools. I personally use all four languages, each one for specific purposes where the fit best. You can find function names like strstr in C, C++ and PHP (= indexOf in Java and JavaScript) - not a big deal.

Re: Announcing a specification for PHP

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

I thought something along the lines of keeping the existing global namespace mess but also add in namespaced, consistent aliases like you've suggested, i.e. myStr.replace()

As the new ones get more use, slowly deprecate and remove the original global namespaced functions, in the same way they phased out register_globals

Re: Announcing a specification for PHP

#38

Rookie question, but what does a language specification for PHP do or mean? I assume this is good, but don't know why. :)

The obvious thing it does is lays the groundwork for multiple first-class implementations. As it stands, the program php essentially is the reference: whatever it does, implementation quirks, bugs, and all, is what php should do.

Re: Announcing a specification for PHP

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

Re: Announcing a specification for PHP

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

If you want to order your program in a specific way, you introduce the appropriate level of abstraction. Same as with any other language. EDIT: i totally agree that the standard functions are a complete mess in PHP. But they have to stay around for backwards compatibility. Have a look at the SPL classes: http://php.net/manual/en/book.spl-types.php

When you're talking about the core libraries that ship with the language, it seems unreasonable for every PHP developer to have to introduce it themselves.
Post reply on HN