Facebook have introduced a new programming language, which looks mostly like an extension to PHP. They've called it Hack and it's running on their HHVM engine.
After seeing their website and reading a bit about it, I wondered how fluid a migration from PHP to Hack could potentially be.
Let's base this discussion around a web application already deployed to a LEMP or LAMP stack.
Some of my initial thoughts and list of actions include:
So, how would you approach this?
Hack is mostly backward-compatible with PHP code, although it extends the PHP language with strict typing, new data structures, and a real-time type checking server. That being said, Hack's own developers prefer to call Hack a dialect of PHP and not a new language.
Hack is built from the ground up to enable static type checking, with features PHP lacks like generics, shapes, enums, hack arrays, and a well-typed standard library to enable rigorous static analysis.
HipHop Virtual Machine (HHVM) is an open-source virtual machine based on just-in-time (JIT) compilation that serves as an execution engine for the Hack programming language and used to support PHP execution before the release of HHVM version 4.
HHVM is an open-source virtual machine designed for executing programs written in Hack. HHVM uses a just-in-time (JIT) compilation approach to achieve great runtime performance while maintaining amazing development flexibility. HHVM supports the Hack programming language.
I'm an engineer at Facebook who worked on Hack. In particular, I wrote several parts of the conversion tools and then applied them across Facebook's codebase. This indeed should probably be several questions -- it depends on how exactly your project is set up, what PHP feature you're using, and so forth. Some good starting resources include:
That's what you need to get started. Specific followups would be best asked as a separate question. I'll try to keep an eye on SO and answer where I can to help folks get started! You can also join us on IRC, #hhvm on Freenode.
From the sounds of it, it will be nearly seamless to transition. From the Wired Article about it:
Hack will be particularly attractive, Adermann says, to existing PHP shops. “Ironically,” he says, “its chief advantage is how little it differs from PHP.” Like Facebook, these shops can gradually move their operations from one language to the another.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With