Taking PHP Seriously
infoq.com
infoq.com
1) A resource like "PHP - The Good Parts", that guided developers through the dos and don'ts of the language at an early stage.
2) An overlay language (like Coffeescript over Javascript) that effectively hides the bad parts, but that might also be extended to bring some consistency to the library APIs (even a bunch of aliases that used consistent naming rules would help).
I'll admit that I have written anything serious in PHP since the late '90s but those are the issues we had bring new developers up to speed.
2) There's been a couple of these, most recently Mammouth[0], but personally I don't think that's useful - the syntax is more or less OK. I do think that renaming the core functions and then providing an alias/compatibility library would be beneficial however.
Personally, the most inviting part of HHVM for me isn't the performance, it's the alternative team that seem willing to develop the language more in-line with what users want.
Totally agree with that. In the real world, one is normally using some sort of framework which hides most of the language quirks (inconsistent naming, order of parameters, etc). And the cases, when you need to use quirky native functions, are rear enough so that introducing additional layer where bugs might occur is not beneficial enough. So I'd focus more on picking the right framework (both philosophically and technically) rather than on focusing on a new language.
Why I mention frameworks that much? Because in the of majority cases, applications are just some CRUD with a bit of logic and going with flat php + some home made libraries is just waste of time.
It's not like javascript where you dont control the client, you control everything that is running on your servers.
HHVM is good for Facebook,though i fail to understand how they could not migrate to any other serverside language given the number of developpers they hire, unless the legacy code is an unmaintainable,unreadble mess. Twitter did it(rails to jvm).
That way they could simple move PHP to the other language, and write whatever new in the other language?
Not exactly the same, but "PHP - The Right Way" [1] is a good starting point.
We invent bad languages, they spread everywhere like plague and then we're like "hey, let's create an overlay language to hide the hideousness". It's insane.
Facebook were forced down the road of supporting PHP because, just like everyone else everywhere else, they found it is several orders of magnitude more expensive to bring good features and lessons learned to a completely new language, stack or framework.
Its kind of awful that new projects will see this as a new lease of life for PHP, rather than life support, but that's just inevitable. I guess it's both.
PHP was not initially intended to become what it has: it wasn't invented to be what it has turned out to be. But don't complain too much: dealing with that sort of legacy is what keeps some of us in active employment! (not them I'm implying anyone causes these issues on purpose, you'd have to be both a special sort of evil and a special sort of intelligent to create PHP4 (I've not used it since then, things may have improved massively recent years (they were certainly promising to) and I'd be non the wiser) with all its problems on purpose)
Java -> HotSpot, Python -> PyPy, Javascript -> V8 and friends, PHP -> HHVM
Since quite some time most Lisp systems don't use a JIT. They compile the code ahead of time or explicitly incrementally.
I am aware of type hints, but given Lisp's dynamic nature, wouldn't a JIT provide more optimized code than AOT?
The smart part is that it's opt-in so you could gradually migrate a large project in-place. The only question would be whether they've broken compatibility with standard PHP or if it's simply stricter — it'd be really easy to get major projects to switch if it was like JavaScript's "use strict" where you can develop in strict mode but run on a legacy runtime.
Perhaps HHVM just need to be installed and then a change to your Nginx/Apache config needs to happen?
Serious kudos to FB and the developers who are making this happen!
E.g. gradual typing with type inference, generics, closures, nullable types, generators and a lot of static checks and removals of "arguably dumb" php features.
It offers an alternative syntax that allows you to give return types of functions, which can give you further speed improvements. There's also a few additional features (for example, it supports similar hinting to the recent ArrayOf RFC).
It's worth checking out, but probably not worth using in production yet - they're working on getting the top 20 frameworks to pass their unit tests in HHVM[0], so there's a good chance your existing apps will run.
[0]: http://www.hhvm.com/blog/2813/we-are-the-98-5-and-the-16
It's great as it makes everything run a lot quicker for clients who use PHP, especially if you have code that needs to be run in PHP on the command line.
Just run it and see :).
They're both Facebook projects and one grew inspired by another, but they use different approaches.
Edit: The speaker in the video also mentions that they have taken the test suites from the top twenty PHP projects and they test them against new releases of HHVM, further confirming that the syntax requires no special attention except for new language constructs.
Code does not have to be written in a certain way most of the time because hhvm is 98% compatible to all major PHP-Frameworks[1]. It also features a built-in webserver alltough static performance is lower than nginx.
[1] http://www.hhvm.com/blog/2813/we-are-the-98-5-and-the-16
Confession: I haven't listened to the OP yet.