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


RAG from Scratch
10/12/2024

The "RAG from Scratch" tutorial by Langchain coupled with the "RAG playground" are two great educational resources that will help you kickstart your journey with RAG.



AI At edX With 30% Savings
13/12/2024

edX is offering a 30% discount on selected courses and program bundles until December 19th. We look at  AI-related certifications that could boost your resume in 2025.


More News

 

espbook

 

Comments




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