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.

hhvm1

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).

 hhvm

More Information

HHVM Site

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.

 

Banner


Apache Arrow 21 Released
07/07/2025

Version 21 of Apache Arrow has been released, including the first official Swift implementation of the platform. Improvements to Arrow 21 include exposing gRPC in the Flight client builder and improve [ ... ]



Scylla Launches ScyllaDB X Cloud
19/06/2025

The developers of ScyllaDB have announced an updated version of the managed version of its database that is aimed at meeting workloads based on demand.


More News

 

pico book

 

Comments




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