HHVM Improves Type Inference
Written by Kay Ewbank   
Friday, 19 January 2018

There's a new version of Hip Hop Virtual Machine, an open-source virtual machine designed for executing programs written in Hack and PHP.  HHVM was originally developed at Facebook to provide a way to convert PHP script to C++ so it could be compiled and run on web servers.

HHVM uses just-in-time (JIT) compilation to combine good performance with a flexible development environment. HHVM supports Hack, PHP 5 and the major features of PHP 7.

This release is important as it is the last release to have PHP 5 as a main focus. The developers at Facebook said in September that HHVM would not be developed to target PHP 7. Their reasoning was that:

"the HHVM team believes that we have a clear path toward making Hack a fantastic language for web development, untethered from its PHP origins. We’d do ourselves and our users a disservice by positioning HHVM as an uncommon, less well-documented, less compatible PHP7 runtime."

On this basis, while they expect Hack and PHP7 to retain a good deal of overlap for the time being, and many users may find success using the runtimes interchangeably in the short term, the team does not intend HHVM to be the runtime of choice for developers with pure PHP7 code who are using PHP's more recent additions. Going forward, the Facebook developers recommend developers migrate to Hack or PHP7.

Hack is Facebook's development onward from HHVM. Hack is a programming language for HHVM that is statically typed.  Hack has been in use at Facebook long enough for the the entire codebase to have been moved across to it and there is an open source version complete with HHVM. There are also some tools included to make conversion easier.

In practical terms for this release of HHVM, 3.24, the improvements start with better handling of Hack code. Reference arguments must now be marked at the call site, not just at the function declaration. The team has extended HHAST to automate migrations.


Support has been added for 'using' blocks as an alternative to destructors. “Using” blocks provide a mechanism to limit an object to a particular scope, invoking code on scope exit, without using destructors.

Type inference and type checking for lambdas is another area that has been improved.

XHP is another area to have received improvements. The XHP attribute spread operator has been added, and the developers have improved the typing of XHP attributes and children.

Other improvements are clearer error messages, and improved handling of multiple debuggers (e.g. hphpd + xdebug).


More Information


Related Articles

Facebook Introduces Hack, A Better PHP 

HHVM, Bash And CoffeeScript

PHP At 20

To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on, Twitter, Facebook or Linkedin.



Computer History Under the Hammer

If you crave for a slice of computer history, an online auction from Bonhams salerooms in Los Angeles on November 5th provides plenty of choice. If you don't have deep enough pockets, just browsing th [ ... ]

TypeScript 4.1 Adds Temporal Literal Types

TypeScript has been updated with new checking flags, editor productivity updates, and speed improvements, alongside new features including support for temporal literal types.

More News






or email your comment to: comments@i-programmer.info