HHVM Improves Type Inference
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, FacebookGoogle+ or Linkedin.

 

Banner


Are You Ready For GDPR?
04/05/2018

GDPR is European legislation that comes into force on May 25th and will affect any business, online or otherwise, that keeps personal data on European citizens. If you don't know how this affects you, [ ... ]



Online Master Of Computer Science Degrees From Coursera
15/05/2018

Both the University of Illinois and Arizona State University are now offering Master's degrees in Computer Science in partnership with Coursera. Is gaining an online masters a worthwhile undertaking?

 [ ... ]


More News

 

justjsquare

 



 

Comments




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

 
 

   
Banner
Banner
RSS feed of news items only
I Programmer News
Copyright © 2018 i-programmer.info. All Rights Reserved.
Joomla! is Free Software released under the GNU/GPL License.