BT

PHP Evolved: Facebook's New Hack Programming Language

by Jeff Martin on Mar 27, 2014 |

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.

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.

Tell us what you think

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

Email me replies to any of my messages in this thread

Hack Language Tutorial by santosh tewari

Hey Friends find tutorial of Hack language here:

sickprogrammersarea.blogspot.in/

have fun

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

Email me replies to any of my messages in this thread

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

Email me replies to any of my messages in this thread

1 Discuss

Educational Content

General Feedback
Bugs
Advertising
Editorial
InfoQ.com and all content copyright © 2006-2014 C4Media Inc. InfoQ.com hosted at Contegix, the best ISP we've ever worked with.
Privacy policy
BT