Skip to content
loading...

re: PHP needs its own ES6 VIEW POST

TOP OF THREAD FULL DISCUSSION
re: Have you tried Hack PHP from Facebook? It's basically what you're recommending here plus a lot more (strong typing and generics, for example).
 

I actually haven't. I've heard about it but never actually gave it a spin. Is it "backwards" compatible with PHP in a way that I could just start running my existing PHP app as a Hack app and slowly start using its better features?

 

Yes - I have had the pleasure of developing on Hack and I like to describe it as a blend of PHP, JavaScript, and Java, since it takes some of the best features from each (and adds more). It was built to be fully compatible with PHP so that Facebook could slowly migrate its giant code base without breaking any existing functionality.

That being said, I've never had to setup Hack on a server. The major difference is that Hack is a compiled language, so it requires significantly different server software to build & run (HHVM last time I checked). Depending on how your current PHP app is setup, this may turn out to be a simple or complex task.

Great, I'll have to put Hack on my list-to-learn and take a look at it in some point.

ES6 needs transpiling as well so needing to have a few extra steps with Hack is not really an issue.

code of conduct - report abuse