BT

InfoQ Homepage News PHP Evolved: Facebook's New Hack Programming Language

PHP Evolved: Facebook's New Hack Programming Language

Bookmarks

Facebook's propensity for PHP is fairly well-known. Dating back to the company's early days, PHP has powered many of the company's offerings. One of PHP's strengths is that it is a dynamic language well-suited to rapid prototyping, but this same attribute tends to complicate the development and maintenance of large code bases. To address these concerns, Facebook has released Hack, a new programming language intended to maintain PHP's strengths while augmenting this with what they call gradual-typing and several new language features.

 

This use of gradual typing means in Hack dynamic and statically-type code can inter-operate in the same file. This lets existing PHP code be converted to Hack according to the needs of each project it is used in without requiring a large up-front conversion cost. To assist with a PHP to Hack migration, Facebook is providing conversion tools. Hack itself works by monitoring your source file as you edit it. A system daemon monitors your local filesystem, and when changes are saved to disk a type checker will quickly analyze the changes. Facebook indicates that this turnaround averages 200ms and should rarely exceed 60 seconds.

 

Hack isn't just bringing typing characteristics, it is also providing several additional language features. These include type annotations, nullable types, generics, collections, and lambdas. The Hack language reference provides full details on all features currently available. Just like the PHP code at Facebook, Hack runs on Facebook's Hip Hop Virtual Machine (HVVM) which uses just-in-time compilation to boost program performance.

 

For more background on PHP at Facebook, InfoQ published an interview with Facebook's Keith Adams this past December.

Rate this Article

Adoption
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

BT

Is your profile up-to-date? Please take a moment to review and update.

Note: If updating/changing your email, a validation request will be sent

Company name:
Company role:
Company size:
Country/Zone:
State/Province/Region:
You will be sent an email to validate the new email address. This pop-up will close itself in a few moments.