Skip to main content

Facebook unveils Hack, a faster programming language to power the social network

The trophy for the Facebook Hacker Cup.
Image Credit: Jolie O'Dell

At Facebook, the codebase that runs the social networking site is written in Hack.

The Menlo Park, Calif.-based social networking titan said it had streamlined PHP, made it better, and that Hack was now the official language running the site used by 1.2 billion users. Facebook engineers embellished the code internally and announced the upgrade Thursday, according to a post.

Facebook did not post the update to its site, but the beta version is now live and can be seen here.

Company engineers said inherent challenges in the PHP code sometimes made simple tasks “tricky or cumbersome” and that coding errors were sometimes not detected until the script had gone live. Hack has changed that, Facebook said.  Thus, the company said, “Hack was born.”


June 5th: The AI Audit in NYC

Join us next week in NYC to engage with top executive leaders, delving into strategies for auditing AI models to ensure fairness, optimal performance, and ethical compliance across diverse organizations. Secure your attendance for this exclusive invite-only event.


Facebook explained that one of the major embellishments to PHP thus:

“Our principal addition is static typing. We have developed a system to annotate function signatures and class members with type information; our type checking algorithm (the type checker) infers the rest. Type checking is incremental, such that even in the same file, some code can be converted to Hack while the rest remains PHP. Technically speaking, Hack is a gradually typed language: dynamically typed code interoperates seamlessly with statically typed code.”

“The Hack adds additional features beyond static type checking, including collections, lambda expressions, and run time enforcement of return and additional parameter types….We are delighted to open-source both Hack and the tools that we used to convert our codebase (http://hacklang.org).”

Facebook is hosting a Hack-related event at its campus next month. Believe us — we’ll have more soon.